A
Alan
The code below runs fine in Excel 2007, but 2003 does not like it.
I`m not sure why. It gives me a runtime error and says it is unable
to set the Locked property of the range class.
I tried commenting out the first line (WS.Cells.Locked = False) and
changing the second statement to"
WS.Range(Cells(row,col),Cells(row,col)).Locked = True
However, this did not help.
Does anyone see what I am doing wrong? Thanks, Alan
Sub DisableCellInput(WS As Worksheet, row As Long, col As Long)
'
' This subroutine locks and greys out the cell
'
WS.Cells.Locked = False
' Lock cell for input
WS.Cells(row, col).Locked = True
' Fill cell with light grey
WS.Cells(row, col).Interior.ColorIndex = 15
' Turn text into a slightly darker grey
WS.Cells(row, col).Font.ColorIndex = 48
' Protect the worksheet
WS.Protect UserInterfaceOnly:=True
End Sub
I`m not sure why. It gives me a runtime error and says it is unable
to set the Locked property of the range class.
I tried commenting out the first line (WS.Cells.Locked = False) and
changing the second statement to"
WS.Range(Cells(row,col),Cells(row,col)).Locked = True
However, this did not help.
Does anyone see what I am doing wrong? Thanks, Alan
Sub DisableCellInput(WS As Worksheet, row As Long, col As Long)
'
' This subroutine locks and greys out the cell
'
WS.Cells.Locked = False
' Lock cell for input
WS.Cells(row, col).Locked = True
' Fill cell with light grey
WS.Cells(row, col).Interior.ColorIndex = 15
' Turn text into a slightly darker grey
WS.Cells(row, col).Font.ColorIndex = 48
' Protect the worksheet
WS.Protect UserInterfaceOnly:=True
End Sub