Pflichtfelder
Markus
Kann mir bitte jemand helfen.
Folgender VBA-Code funktioniert nur auf der 3 Zeile. Ich möchte aber gerne, dass der Code auf der gesammten Tabelle funktioniert:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim hinweis
' cells(Zeile, Spalte)
If Cells(3, 1) "" And Cells(3, 13) = "" Then
hinweis = MsgBox("Bitte Pflichtfelder ausfüllen!", vbCritical)
Cells(3, 13).Select
Exit Sub
ElseIf Cells(3, 9) "" And Cells(3, 10) = "" Then
hinweis = MsgBox("Bitte Pflichtfelder ausfüllen!", vbCritical)
Cells(3, 10).Select
Exit Sub
End If
End Sub
Wenn ich den Code wie folgt ändere, funktioniert auch die 4. ZeilePrivate Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim hinweis
' cells(Zeile, Spalte)
If Cells(3+1, 1) "" And Cells(3+1, 13) = "" Then
hinweis = MsgBox("Bitte Pflichtfelder ausfüllen!", vbCritical)
Cells(3+1, 13).Select
Exit Sub
ElseIf Cells(3+1, 9) "" And Cells(3+1, 10) = "" Then
hinweis = MsgBox("Bitte Pflichtfelder ausfüllen!", vbCritical)
Cells(3+1, 10).Select
Exit Sub
End If
End Sub
Was muss ich eingeben, dass dieser Code Zeile für Zeile funktioniert?Gruss Markus