Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA Hyperlink that acts like command button - is it possible? 1

Status
Not open for further replies.

alwayslrN

IS-IT--Management
Jun 20, 2006
159
US
Is it possible in Excel VBA to have something that looks like a hyperlink, but acts like a command button? - I am using Excel 2002.

I've been searching this site and the web, but I must not be using the correct keywords to find what I am looking for.

Thanks
 

Can you use just regular Label on the Form?

Set its color to Blue, and font to Underline, and use _Click event.


Have fun.

---- Andy
 



Hi,

"...looks like a hyperlink..."

What does hyperlink have to do with the functionality?

Does this mean that if the TEXT in the cell is formatted as Andy described above, then clicking in that cell will trigger an event, but some other cell that is not so formatted will do nothing when selected?

Are ALL the values in this column so formatted or are thes scattered throughout the sheet in different rows and columns?

Skip,

[glasses] To be safe on the [red]FOURTH[/red],
Don't take a [red]FIFTH[/red] on the [red]THIRD[/red]
Or you might not come [red]FORTH[/red] on the [red]FIFTH[/red]
[red][highlight blue]FORTH[/highlight][/red][white][highlight red]WITH[/highlight][/white] [tongue]
 
Yes it means take text and when clicked have it do something. No not ALL values in the column are formatted. There would be just be about 5 specific pieces of text that when clicked would perform an action, like when a button is clicked.
 




This has NOTHING to do with formatting.

It is the Worksheet_SelectionChange Event.

Right click the sheet tab and select [v]View Code[/b]

In the Sheet Code Window click the Object Drop Down and select Worksheet

In the Sheet Code Window click the Prodecure Drop Down and select SelctionChange
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Target, Union(Range("A1"), Range("C2"), Range("K5"))) Is Nothing Then
    'do something here...

  end if
End Sub
where A1m C2 & K5 are the specified cells



Skip,

[glasses] To be safe on the [red]FOURTH[/red],
Don't take a [red]FIFTH[/red] on the [red]THIRD[/red]
Or you might not come [red]FORTH[/red] on the [red]FIFTH[/red]
[red][highlight blue]FORTH[/highlight][/red][white][highlight red]WITH[/highlight][/white] [tongue]
 
Thanks Skip - that did what I wanted/needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top