End With ohne With
23.02.2021 15:10:31
Sonja
ich habe ein Makro kopiert, welches in der gleichen Datei wunderbar in einem anderen Tabellenblatt funktioniert.
Jetzt bekomme ich immer eine Fehlermeldung:
Fehler beim Kompilieren:
End With ohne With
Wahrscheinlich habt Ihr den Fehler gleich im Blick - ich versteh die Welt nicht mehr. Danke schon mal vorab..
hier der Code:
Option Explicit
Private Sub CommandButton1_Click()
Sheets("Regie").Unprotect Password:="PW"
Rows("1:5").Select
Selection.EntireRow.Hidden = False
Dim lUpdRow As Long
With Worksheets("Regie")
If pLRow = 0 Then
lUpdRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
Dim newRow As Long
newRow = Cells(Rows.Count, 5).End(xlUp).Row + 1
Rows("3:3").Copy Cells(newRow, 1)
Application.CutCopyMode = False
Rows("1:4").Select
Selection.EntireRow.Hidden = True
Else
lUpdRow = pLRow
End If
' nur Texte
.Cells(lUpdRow, 2).Value = ComboBox1.Value
.Cells(lUpdRow, 6).Value = ComboBox3.Value
' nur Datum
If TextBox3 "" Then
If IsDate(TextBox3) Then
.Cells(lUpdRow, 11).Value = CDate(TextBox3)
End If
' nur Währung
.Cells(lUpdRow, 35).Value = TextBox83
If TextBox83 "" Then
.Cells(lUpdRow, 35).NumberFormat = "#,##0.00 $"
.Cells(lUpdRow, 35).Value = CDbl(TextBox83.Text)
End If
End With
Sheets("Regie").Protect UserInterfaceOnly:=True, Password:="PW"
'Userform schließen
Unload UserForm_Regie
End Sub