ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button-click to jump another sheet (https://www.excelbanter.com/excel-programming/390361-button-click-jump-another-sheet.html)

PalyanJoe

Button-click to jump another sheet
 
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

Jim Thomlinson

Button-click to jump another sheet
 
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
--
HTH...

Jim Thomlinson


"PalyanJoe" wrote:

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


Tom Ogilvy

Button-click to jump another sheet
 
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

--
Regards,
Tom Ogilvy

"PalyanJoe" wrote:

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


PalyanJoe

Button-click to jump another sheet
 
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":

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

--
Regards,
Tom Ogilvy

"PalyanJoe" wrote:

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


PalyanJoe

Button-click to jump another sheet
 
Thank you Jim. Your code worked well as well. Now I will work on my code
based on your coding techniques.

"Jim Thomlinson":

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

Jim Thomlinson


"PalyanJoe" wrote:

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



All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com