Goto Cell referenced in another cell

brianfosterblack

Active Member
Joined
Nov 1, 2011
Messages
251
On my 1Master Worksheet I want to go to the worksheet and cell referenced in Cell 1Master!Z6
I have used a formula to create a reference Muller!R1C1 (also tried a formula to create a reference Muller!A1) - Reference is based on the Worksheet name selected
I then used this code in my macro to got to this reference
VBA Code:
Application.Goto Reference:=Range("1Master!Z6").Value
This is not working although it does work in other older workbooks I have.
I am doing this as I have a form which shows me all the worksheets in my workbook. I select the worksheet from the form which then puts the formula into Z6 so I can go to cell A1 of the selected Worksheet.
Can anyone please help me? I am probably doing this all wrong
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try it like
VBA Code:
Application.Goto Reference:=Range(Range("1Master!Z6").Value)
 
Upvote 0
Try it like
VBA Code:
Application.Goto Reference:=Range(Range("1Master!Z6").Value)
Hi fluff,
This is not working. I get the following error
VBA Code:
Runtime error 1004
Method 'Range' of object'_Global'failed
I currently have the result of my formula in Z6 showing as MyGas!R1C1
I have also tried with the formula result as MyGas!A1
I copied your code and pasted it exactlyas is into my macro
It hits error on the line of code you provided above.
 
Upvote 0
Where is the code located?
 
Upvote 0
Where is the code located?
In a VBA Module
VBA Code:
Sub GotoWorksheet()
    Sheets("1Master").Select
    Range("1Master!Z4").ClearContents
    FrmTab.Show
    If Range("1Master!Z4").Value = 1 Then
    Exit Sub
    End If
    If Range("1Master!Z4").Value = "" Then
    MsgBox ("You did not select a Worksheet, Try again")
    Exit Sub
    End If
    Application.Goto Reference:=Range(Range("1Master!Z6").Value)
End Sub
Should the Address in Z6 read as 1Master!Z6 or as 1Master!R1C1
 
Upvote 0
In that case check that the sheet name is a valid sheet name.
Also if the sheetname contains spaces you need to include the relevant apostrophes in the name.
 
Upvote 0
The Sheetname
In that case check that the sheet name is a valid sheet name.
Also if the sheetname contains spaces you need to include the relevant apostrophes in the name.
Iis a valid sheetname. I am using it in other VBA macros and it works fine
There are no spaces in the sheetname or at the end of the sheetname
In that case check that the sheet name is a valid sheet name.
Also if the sheetname contains spaces you need to include the relevant apostrophes in the name.
Hi Fluff, I slept on it and came back to it this morning to realize the problem was that my worksheet reference in in cell Z5 not Z6.
Sorry for wasting your time. Thank you for your patience and help.
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top