ich habe folgendes Problem, ist es möglich in einer Arbeitsmappe alle z.B. nicht gelb markierten Zellen
zu sperren und wieder zu entsperren?
Danke im Voraus für eine Antwort.
Matthias
Sub Makro1()
Dim myR As Range
With ActiveSheet
.Unprotect
.Cells.Locked = True
For Each myR In .UsedRange
If myR.Interior.ColorIndex = 6 Then
myR.Locked = False
End If
Next myR
.Protect
End With
End Sub
zum sperren / entsperren entsprechend .locked = False gegen .locked = True ersetzen.Sub AlleWorksheets
Dim wks as worksheet
For each wks in Activeworkbook.worksheets
With wks
usw usw
end with
End Sub
Sub Makro1()
Dim wks As Worksheet, myR As Range
For Each wks In ActiveWorkbook.Worksheets
With ActiveSheet
.Unprotect
.Cells.Locked = True
For Each myR In .UsedRange
If myR.Interior.ColorIndex = 6 Then
myR.Locked = False
End If
Next myR
.Protect
End With
Next wks
End Sub