View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I think I'd just drop the hyperlink and use a macro directly.

Put a bunch of references in A1:A10 of a worksheet.
like:
sheet2!a5
'sheet 99'!b99
'this is a test'!c12

Excel uses the apostrophe to force a value to be text. I actually typed in:

''this is a test'!c12

But excel didn't show that first apostrophe in the cell.

Then rightclick on the worksheet tab and choose View Code.

Paste this in:

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, _
Cancel As Boolean)

Dim testRng As Range

If target.Cells.Count 1 Then Exit Sub

If Intersect(target, Me.Range("a1:A10")) Is Nothing Then Exit Sub

Set testRng = Nothing
On Error Resume Next
Set testRng = Application.Range(target.Value)
On Error GoTo 0

If testRng Is Nothing Then
'do nothing
Beep '?
Else
Application.Goto testRng, scroll:=True
Cancel = True
End If

End Sub

This looks for a double click on that cell.


Bill Elerding wrote:

I have set up hyperlinks in a table of contents that jumps to specific
categories (individual cells) on the next worksheet. I'd like to have a
macro execute automatically after the link to have that cell be situated at
the upper left of the screen. I'm just beginning to get into macro's, and
have not been able to figure this one out, even after checking other posts on
this site. Thanks in advance!
--
William Elerding


--

Dave Peterson