Cell Colouring

mattie

New Member
Joined
Mar 26, 2010
Messages
20
I am getting a bit stuck with changing the colour of some cells.

I have a link on sheet 1 that goes to a cell on sheet 2, what i am wanting to do is when the link goes to the cell on sheet 2 it changes the colour of that cell and the two next to it to highlight it.

I have had a try but i am not getting that far.

any help would be appericated!

Matt
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
And after the hyperlink is followed and the target cell ( and the two next to it ) has been highlighted, what is the action that will reset the highlighting on the cells? Will it be when any other cell there is selected afterwards? And maybe also when that sheet is deactivated? Or what?
 
Upvote 0
The 3rd cell is a hyperlink back to sheet1 so once that is clicked the colouring will be reset. There are about 15 rows of text so i wanted the colouring to make it easier for the reader to see the wording for the link they selected on sheet1
 
Upvote 0
Try putting this in the sheet code area, for the sheet that contains the first hyperlink ( right-click the sheet tab and choose View Code ):
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    ActiveCell.Resize(1, 3).Interior.ColorIndex = 3
End Sub
And put this code in the sheet code area of the target sheet, so as to reset shading:
Code:
Private Sub Worksheet_Deactivate()
    Me.UsedRange.Cells.Interior.ColorIndex = 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top