Select a cell based on a named range that contains a cell reference

jerry12302

Active Member
Joined
Apr 18, 2005
Messages
449
Office Version
  1. 2010
Platform
  1. Windows
I have a range named GoToLink in Sheet2 that contains a cell reference, currently "Annual Revenues"!C5

I want the macro to go to the referenced sheet, "Annual Revenues", and select the cell C5.

I have tried many examples that I have found on the web, here and elsewhere, that do not work, even though the person asking replied that it worked. I'm using Windows 7 and Office 2010.

I've tried to simplify it by using code I found that just selects the sheet based on another cell. In Sheet2 C6 contains the sheet name, "Annual Revenues" (including the quotes).

Sub SelectCell
ThisWorkbook.Sheets(Worksheets("Sheet2").Range("C6").Value).Activate
End Sub

I get the error "Subscript out of range".

If I were to hard code the sheet and cell reference it would look like this, which works of course...

Sub SelectCell
Sheets("Annual Revenues").Select
Range("C5").Select
End Sub

How do I substitute the sheet name and cell reference using my range GoToLink which contains "Annual Revenues"!C5 ?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Change the cell value to
''Annual Revenues'!C5
NOTE it needs to be two ' at the start & not a "
Then you can use this
VBA Code:
Application.Goto Range(Sheets("Sheet2").Range("Gotolink")), True
 
Upvote 0
Wow, that was one of the variations of code I found and tried before. I was going nuts trying to figure out why something so simple wouldn't work.

All because of a '.

Thank you Fluff, this works perfectly now.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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