View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Check cell contents then format as locked

Sub LockRow()
Dim cLastRow As Long
Dim i As Long

cLastRow = Cells(Rows.Count, "K").End(xlUp).Row
For i = 1 To cLastRow
If Cells(i, "K").Value = "Y" Then
Cells(i, "K").EntireRow.Locked = True
End If
Next i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Katherine" wrote in message
...
I need a snippet of code that will check each cell in column K for the

value
"Y" - if there's a Y in the cell, I want to format that entire row as

locked
and then move down to check the next cell etc

Can anyone help me with the syntax please?