Consulting

Results 1 to 5 of 5

Thread: Solved: Error Message when trying to highlight specific cell

  1. #1

    Solved: Error Message when trying to highlight specific cell

    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"?

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

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,877
    Is the cell locked and the sheet protected?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    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?

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,877
    [vba]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
    [/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    It is working well.
    thx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •