i am trying to specify the column Names which is to be locked
Sub LockCol()
Application.ScreenUpdating = False
ActiveSheet.Unprotect "password"
Dim foundCol As Range
Dim response As String
response = IntersectColumnRows ActiveSheet, "", "ITEMNUM", "ORIGINAL MFG NAME" -----in this line
Set foundCol = ActiveSheet.Rows(1).Find(response, LookIn:=xlValues, lookat:=xlWhole)
If Not foundCol Is Nothing Then
Columns(foundCol.column).EntireColumn.Locked = True
Else
MsgBox ("Column not found.")
End If
ActiveSheet.protect "password"
Application.ScreenUpdating = True
End Sub
Bookmarks