Protect cell - VBA

  • Thread starter Thread starter Avi
  • Start date Start date
A

Avi

Hi,

I want to protect cells of a particular color usning this code

Sub Protectme()
For i = FirstRow To RowCount 'row
For j = FirstCol To Colcount ' col
If CellColorIndex(Cells(i, j)) = 24 Then
Range.Cells(i,j).Locked = True --- Some problem in this line
End If
Next j
Next i
ActiveSheet.Protect
End Sub

This gives me a run time error.. Can somebody help me ??

Thanks,
Avinash
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top