ElectricSkywalker
Board Regular
- Joined
- May 27, 2002
- Messages
- 112
Hi there,
I have a spreadsheet with a number of inputs in it.
All of the input cells have an Interior Colour of 6 (yellow).
Everything else either has a formula, is a fixed digit, or is empty.
What I want....Is to create a macro so that everything with interior colour is NOT locked/protected....and everything else is.
The following was suggested to me...but is still a little slow:
Private Sub CommandButton1_Click()
Dim x As Integer
Dim y As Integer
For x = 1 To 100
For y = 1 To 100
If Cells(x, y).Interior.ColorIndex = 6 Then
Cells(x, y).Locked = False
Else: Cells(x, y).Locked = True
End If
Next y
Next x
End Sub
Thanks for your advice
I have a spreadsheet with a number of inputs in it.
All of the input cells have an Interior Colour of 6 (yellow).
Everything else either has a formula, is a fixed digit, or is empty.
What I want....Is to create a macro so that everything with interior colour is NOT locked/protected....and everything else is.
The following was suggested to me...but is still a little slow:
Private Sub CommandButton1_Click()
Dim x As Integer
Dim y As Integer
For x = 1 To 100
For y = 1 To 100
If Cells(x, y).Interior.ColorIndex = 6 Then
Cells(x, y).Locked = False
Else: Cells(x, y).Locked = True
End If
Next y
Next x
End Sub
Thanks for your advice