• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight a Cell with VBA

I have a worksheet sample, attached. When you click the arrow symbol, it takes you to a cell and shades it in yellow. When I choose another cell elsewhere on the sheet, though, I want the highlighted cell to revert to "no fill." Can you help?
Thanks
 

Attachments

  • Highlight.xlsm
    19.7 KB · Views: 5
Paul

Refer the attached file:
 

Attachments

  • Highlight.xlsm
    23.4 KB · Views: 16
Thank you. I adapted your code to work in my file, like this:
72379

It shades the selected cell all right, but when I click away, it does not clear the shade in AboutPtWeights. What am I doing wrong?
 
I see both codes. One is assigned to the object (arrow) and the other in Sheet1 module. My questions above about which one to use and how to assign it to a new object in another workbook still remain.
 
Wait--I did run into one problem. It only works if I don't have protection enabled. I put enable protection into the module macro:

72494

And this works fine. But when I select another cell (move away from AboutPatientWeights), it triggers an error in the Sheet code:

72495

How can I fix this?
 
It's attached. The object, in this case, is Patient Weights at the top of the sheet. If you protect the sheet, it triggers an error. Otherwise, it works just as you designed it. Thanks so much.
 

Attachments

  • Pt Wts Extract.xlsb
    940.6 KB · Views: 7
Back
Top