go to based on cell value

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
Hi

I have an excel sheet with a list name ranges in entire workbook, and wanted to create a macro, so that when the user click on the one of these cells in sheet, it would jump to the named range.

e.g. the value of cell A1 is septweek1. septweek1 is actually a named range that points to =dept1!$B$6

The column that contains the list of named ranges is A:A

this is the code I have tried, but doesn't work


Code:
Private Sub Worksheet_Activate()

Dim a As String
a = ActiveCell.Value
Application.Goto Reference:=a
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then Application.Goto Range(Target.Value)
End Sub
 
Upvote 0
managed to figure out, thanks

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then Application.Goto reference:=Target.Value
End Sub
 
Upvote 0
Hi , this was a legitimate named reference. worked with other code.

Problem with the working code, is the go to cell reference is not appearing in the top left of the sheet, so we have to scroll to see the info we have jumped to.

Any ideas on how to correct this?

Thanks
 
Upvote 0
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then Application.Goto reference:=Target.Value, scroll:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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