AW: was liegt in der Zwischenablage? oT (Tino n. Toni)
07.12.2014 21:27:25
DirkR
Hallo Tino,
ich kopiere einen Tabellenbereich.
hier der Code:
Private Sub CommandButton5_Click()
'#### Kunde EMAIL
Dim Empfänger As String, Betreff As String
Dim Zeile As Long, Spalte As Long, I As Long, J As Long
UserForm1.Show
Select Case (Me.Tag)
Case (1)
'Blanko
'With Sheets("Blankomail Interessent")
' .Range("A1:B" & LastRow(Sheets("Blankomail Interessent"))).Copy
'End With
Case (2)
'Erstmail
With Sheets("Erstmail Interessent")
.Range("A9").Value = IIf(TextBox5.Value = "Herr", "Sehr geehrter Herr ", "Sehr _
geehrte Frau ") & TextBox6.Value & ","
'Ihr persönlicher Ansprechpartner/ Fachberater
For I = 1 To LastRow(Sheets("Erstmail Interessent"))
For J = 1 To LastCol(Sheets("Erstmail Interessent"))
If Left(Cells(I, J).Value, 32) = "Ihr persönlicher Ansprechpartner" Then
Zeile = I: Spalte = J
End If
Next J
Next I
.Cells(Zeile, Spalte + 1).Value = TextBox21.Value 'Name, _
Vorname
.Cells(Zeile + 1, Spalte + 1).Value = "" ' _
Bautechniker???
.Cells(Zeile + 2, Spalte + 1).Value = TextBox22.Value 'Straße _
Haus-Nr.
.Cells(Zeile + 3, Spalte + 1).Value = TextBox23.Value & " " & TextBox24.Value ' _
PLZ_Ort
.Cells(Zeile + 4, Spalte + 1).Value = "" '"Tel. Festnetz: " 'Tel. _
Festnetz
.Cells(Zeile + 5, Spalte + 1).Value = "Tel. Mobil: " & TextBox25.Value 'Tel. _
Mobil
.Cells(Zeile + 6, Spalte + 1).Value = "Fax: " & TextBox26.Value 'Fax
.Cells(Zeile + 7, Spalte + 1).Value = "" ' _
Leerzeile
.Cells(Zeile + 8, Spalte + 1).Value = "E-Mail: " & TextBox27.Value 'E-Mail- _
Adresse
.Range("A1:B" & LastRow(Sheets("Erstmail Interessent"))).Copy
End With
Case (3)
'Zweitmail
With Sheets("Zweitmail Interessent")
.Range("A9").Value = IIf(TextBox5.Value = "Herr", "Sehr geehrter Herr ", "Sehr _
geehrte Frau ") & TextBox6.Value & ","
'Ihr persönlicher Ansprechpartner/ Fachberater
For I = 1 To LastRow(Sheets("Zweitmail Interessent"))
For J = 1 To LastCol(Sheets("Zweitmail Interessent"))
If Left(Cells(I, J).Value, 32) = "Ihr persönlicher Ansprechpartner" Then
Zeile = I: Spalte = J
End If
Next J
Next I
.Cells(Zeile, Spalte + 1).Value = TextBox21.Value 'Name, _
Vorname
.Cells(Zeile + 1, Spalte + 1).Value = "" ' _
Bautechniker???
.Cells(Zeile + 2, Spalte + 1).Value = TextBox22.Value 'Straße _
Haus-Nr.
.Cells(Zeile + 3, Spalte + 1).Value = TextBox23.Value & " " & TextBox24.Value ' _
PLZ_Ort
.Cells(Zeile + 4, Spalte + 1).Value = "" '"Tel. Festnetz: " 'Tel. _
Festnetz
.Cells(Zeile + 5, Spalte + 1).Value = "Tel. Mobil: " & TextBox25.Value 'Tel. _
Mobil
.Cells(Zeile + 6, Spalte + 1).Value = "Fax: " & TextBox26.Value 'Fax
.Cells(Zeile + 7, Spalte + 1).Value = "" ' _
Leerzeile
.Cells(Zeile + 8, Spalte + 1).Value = "E-Mail: " & TextBox27.Value 'E-Mail- _
Adresse
.Range("A1:B" & LastRow(Sheets("Zweitmail Interessent"))).Copy
End With
End Select
Empfänger = TextBox15.Value
Betreff = "Ihre Anfrage"
Call EMAIL_Senden(Empfänger, Betreff)
TextBox15.SetFocus
End Sub
Gruß DirkR