format cells

  • Thread starter Thread starter kevin carter
  • Start date Start date
K

kevin carter

Hi,
I have a worksheet that accepts a user input in the range Ac5:ac200
what i want to do is check if a cell has the value "C" in the above
range
if it does i want to
1 Turn the cell Green
2 Lock the cell range X5:x200
for example if cell ac10 = c
cell ac10 turns green
cell x10 locks for editing

how can i do this with VB?


Thanks
 
Sub test()
For Each cell In ActiveSheet.Range("AC5:AC200")
If cell = "C" Then
cell.Interior.ColorIndex = 4
cell.Offset(, -5).Locked = True
End If
Next cell
End Sub
 
Back
Top