Hi There,
I would really appreciate some asssistance with this. This Macro is only running successfully on 1 Excel Sheet within an Excel work book that has around 10 sheets. I am wanting it to only run on the active sheet that I am working in at the time. I do not want it to run on all sheets at the same time.
Have I dont something wrong with the code or is there something further I can add to specifiy this.
Private Sub Workbook_Open()
Activesheet.Unprotect Password:="Yourpasswordhere"
Dim colorIndex As Integer
colorIndex = 3
Dim xRg As Range
Application.ScreenUpdating = False
For Each xRg In ActiveSheet.UsedRange.Cells
Dim color As Long
color = xRg.Interior.colorIndex
If (color = colorIndex) Then
xRg.Locked = True
End If
Next xRg
Application.ScreenUpdating = True
Activesheet.Protect Password:="Yourpasswordhere"
End Sub
Bookmarks