• 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.

Urgent Help Required in HYPER LINK

AshExcel

New Member
I want to highlight the hyper linked tags whenever it get clicked. I will make my quesry simple by this e.g.

If I am clicking A1 from sheet-1 and it is linked to C4 at sheet-2 than C4 should change its color.

Also, Is it possible if a cropped bar I've pasted on picture. I want it in different color whenever it gets clicked.

Please help me in this as its quite important document for me.

Any help is highly appreciated.

The requirement is for navigation purpose.


Thanks
 
Hi ,


Can you please clarify the following ?


Suppose the cell A1 has a hyperlink attached to it ; suppose the hyperlink is connected to cell C4. If you click on the hyperlink in A1 , the cursor will move to C4. What do you want should happen to C4 ?


The following code will do something ; see if it is what you want.

[pre]
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Application.EnableEvents = False
If ActiveCell.Address = "$C$4" Then
ActiveCell.Font.Bold = True
End If
Application.EnableEvents = True
End Sub
[/pre]

Narayan
 
Thanks Narayan and SirJB7 for your reply.


I will restate my query:


I have three sheets in my workbook.

Sheet-1 has some column say Head Office(A4), Panel #(A5), Region(A6) etc.

Sheet-2 has a Screen shot on which, I have tagged all these field name like Head Office, Panel #, Region etc.

Now when I click Head office(A4) in Sheet-1, as it is hyper linked to J4(Description of Head Office)sheet 2, the cursor is going to that particular cell but its not getting highlighted( the cell color is not changing, I want that it should change its color)


As on sheet 2, I have got around 20-25 tagged cell, so if any cell gets clicked it should change the cell color.


I believe, Now I am able to explain my query.


Please help me in this if possible.


Thanks
 
Hi ,


Thanks for the details ; can you confirm two additional points ?


1. Are these the only hyperlinks in your workbook ? If so , then the FollowHyperlink procedure can be used , without really having to check the Activecell address.


2. Should the color for all the hyperlinked cells be the same , or should every hyperlinked cell have its own color ?


Narayan
 
Hi Narayan,


Thanks for rapid response,


I have around 20 cells on sheet-1 which are hyper linked to respective description cells on sheet-2.

It is OK, if it will highlight in one color only. At least it will be visible to to user.


Thanks again Narayan.
 
Hi ,


Then , you can use the same code , as posted earlier :

[pre]
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Application.EnableEvents = False
ActiveCell.Font.Color = vbBlue Or xlBold
Application.EnableEvents = True
End Sub
[/pre]
This will colour all hyperlinked cells , which have been visited , in Blue + Bold.


Copy and paste this code in Sheet1 section , in the VBA Project Explorer.


Narayan
 
Back
Top