Reputation: 11
I have a workbook containing 22 separate worksheets.
I've colour-coded the input cells green. Is there a formula/macro that automatically unlocks only the green cells and locks everything else.
Upvotes: 1
Views: 729
Reputation:
Try this - replacing the ColorIndex and sheet name where necessary
Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
For Each cell In Sheet1.UsedRange
If cell.Interior.ColorIndex = 35 Then
cell.Locked = False
End If
Next
ws.Protect userinterfaceonly:=True
End Sub
Let me know if you need help looping through each worksheet.
Upvotes: 1