Also, dann setz mal bei allen Zellen Gesperrt auf false (Zellen formatieren) und
pack das hier in das Tabellenmodul:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim tr&, tc%
tr = Target.Row
tc = Target.Column
If tc = 4 Then
If Target.Value = "" Then
lockCells 0
Range(Cells(tr, 1), Cells(tr, 39)).Locked = False
lockCells
Else
lockCells 0
Range(Cells(tr, 1), Cells(tr, 39)).Locked = True
Target.Locked = False
lockCells
End If
End If
End Sub
Und das in ein Standardmodul:
Function lockCells(Optional ByVal lockMode As Boolean = 1)
Dim x As Variant
For Each x In ActiveWorkbook.Sheets
With x
.Protect DrawingObjects:=lockMode, Contents:=lockMode, Scenarios:=lockMode
'.EnableSelection = xlUnlockedCells
End With
Next
End Function
|