I
Irenerz
Hello,
Recently I've been updating some input sheets for our department. The last
person that was here before me created it using some vba code. My vba
knowledge is very primitive at best. Please help!
I have set up an input sheet where you can enter information on the white
spaces (no fill). The other parts of the sheets are shaded a dark grey.
My vba code is suppose to look through each cell in the Range to check if
its colored white, if the cell is white it will unlock it. At the end I want
to protect the sheet and while the white cells that have been unlocked can
have information entered into it.
I have some vba code already and it seems to make sense but it doesn't work
it keeps on giving me errors.. few pointers from the experts would help.
Thanks very much!
Private Sub LockButton_Click()
ActiveWorkbook.Unprotect "password"
Application.ScreenUpdating = False
Dim ws As Worksheet, cell As Range
For Each cell In ws.Range("A:AK")
If cell.Interior.ColorIndex = 1 Then
Exit For
ElseIf cell.Interior.ColorIndex = xlNone Then
cell.Locked = False
End If
Next
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = True
ws.Protect "puddles"
Next
Application.ScreenUpdating = True
Unload Me
End Sub
---
Recently I've been updating some input sheets for our department. The last
person that was here before me created it using some vba code. My vba
knowledge is very primitive at best. Please help!
I have set up an input sheet where you can enter information on the white
spaces (no fill). The other parts of the sheets are shaded a dark grey.
My vba code is suppose to look through each cell in the Range to check if
its colored white, if the cell is white it will unlock it. At the end I want
to protect the sheet and while the white cells that have been unlocked can
have information entered into it.
I have some vba code already and it seems to make sense but it doesn't work
it keeps on giving me errors.. few pointers from the experts would help.
Thanks very much!
Private Sub LockButton_Click()
ActiveWorkbook.Unprotect "password"
Application.ScreenUpdating = False
Dim ws As Worksheet, cell As Range
For Each cell In ws.Range("A:AK")
If cell.Interior.ColorIndex = 1 Then
Exit For
ElseIf cell.Interior.ColorIndex = xlNone Then
cell.Locked = False
End If
Next
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = True
ws.Protect "puddles"
Next
Application.ScreenUpdating = True
Unload Me
End Sub
---