Hallo VBAler,
Ich habe ein kleines Problem und zwar möchte ich gerne, dass eine Zelle (bspw. D1) gesperrt bzw. nicht angewählt wird sofern in Zelle "C1" was bestimmtes steht.
Dies sollte dann möglichst für mehrere Zeilen bis zu 50 gelten. Mein aktueller Code ist wie folgt:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If [A1] <> "...." And Target.Address = "$B$1" Then
[C1].Select
MsgBox "Auswahl"
End If
If [A2] <> "...." And Target.Address = "$B$2" Then
[C2].Select
MsgBox "Auswahl"
End If
If [A3] <> "..." And Target.Address = "$B$3" Then
[C3].Select
MsgBox "Auswahl"
End If
End Sub
Wahrscheinlich kann man das über Cells regeln, also for i = 1 to 50, Cells (i, ..) usw. Aber irgendwie bekomme ich das nicht hin.
Vielen Dank für eure Hilfe
|