PDA

View Full Version : Solved: Error Message when trying to highlight specific cell



AnswerSeeker
04-04-2012, 09:35 PM
The code is looking for a specific cell and I would like to highlight this one, but I always get the error message: "Unable to set Color Property of the Interior class"?

Sub CheckDatabase()
Dim x
Worksheets(1).Visible = xlSheetVisible
Worksheets(1).Activate
x = Index + 2
Cells(x, 2).Select
Selection.Interior.Color = vbYellow
End Sub

p45cal
04-04-2012, 11:48 PM
Is the cell locked and the sheet protected?

AnswerSeeker
04-05-2012, 12:11 AM
yes, it was. I unlocked it and now it is working, thx for this, Is there a way to get the code working and keep some parts of the sheet protected?

p45cal
04-05-2012, 12:24 AM
Sub CheckDatabase()
Dim x
Worksheets(1).Visible = xlSheetVisible
Worksheets(1).Activate
Worksheets(1).Protect UserInterfaceOnly:=True
x = Index + 2
Cells(x, 2).Select
Selection.Interior.Color = vbYellow
End Sub

AnswerSeeker
04-05-2012, 01:48 AM
It is working well.
thx