Button-click to jump another sheet

G

Guest

Hi,
I reviewed all of the related subjects but could not achieve to solve my
link problem. My problem is,
I have a cell Q5 on the master sheet, that calculates a link string. Its
value changes based on my selections in the sheet. For ref. let's assume the
value in Q5 is "Alisan!$H$2" without double-quotes.
I've created a button to use jumping to the sheet-cell that is determined by
the Q5 value. But neither .Activate, nor .FollowHyperlink rows below
worked. Can somebody help me and tell me where I fail?

Sub Button124_Click()
a = Range("Q5").Value
Range(a).Activate
'or ActiveWorkbook.FollowHyperlink Address:=a, NewWindow:=False
End Sub
 
G

Guest

You must first select the sheet and then you can select the range. You can
not do it all in one shot. Something like this...

Private Sub Button124_Click()
Dim strAddress As String

strAddress = Range("Q5").Value
Sheets(Replace(Left(strAddress, InStr(strAddress, "!") - 1), "'",
"")).Select
ActiveSheet.Range(Trim(Mid(strAddress, InStr(strAddress, "!") + 1,
256))).Select
End Sub
 
G

Guest

Sub Button124_Click()
Dim a as String, rng as Range
a = Range("Q5").Value
set rng = Application.Evaluate(a)
Application.Goto rng, True
End Sub
 
G

Guest

I'm very lucky, my programming god helped me. You are the guru, Tom.
Your code did what I want. Thank you very much.

"Tom Ogilvy":
 
G

Guest

Thank you Jim. Your code worked well as well. Now I will work on my code
based on your coding techniques.

"Jim Thomlinson":
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top