View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Activate hyperlink based on cell value


If Range("E5").Value = X Then


Where is X declared and assigned a value? If you don't declare it, VBA
will create a new variable named 'X' and assign it a value of 0. When
you clear out cell E5, it is treated as zero for numeric purposes, so
0 = X and thus triggers the link.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Thu, 9 Apr 2009 13:11:01 -0700, veggies27
wrote:

Mike,

One more try. For my spreadsheet, I converted the code to:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("E5").Value = X Then
Range("B5").Hyperlinks(1).Follow
End If
End Sub

However when I changed the "99" to an "X" it triggers the hyperlink when I
delete the X in the cell, not when I put the X in. Is that a text versus
numberic issue?


"Mike H" wrote:

Hi,

Similar solution

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 99 Then
Range("B1").Hyperlinks(1).Follow
End If
End Sub


Mike


"veggies27" wrote:

Mike,

Sorry for the vagueness.

The hyperlink is already in Sheet 1, B1. I want the input of a "99" in ceel
A1 to bring me to the place that the hyperlink in B1 is set to go.

Jeff

"veggies27" wrote:

I am trying to automatically activate a hyperlink if a certain cell has a
value in it. Is there a way this is possible?