VBA for "GoTo" variable cell reference

cvincent

Board Regular
Joined
Aug 28, 2011
Messages
66
I have a spreadsheet that adds columns daily. I have a cell that finds the maximum value in the row, and also identifies the cell reference.

I want my macro to copy that cell reference into the "goto" box, but I can't make the cell reference variable.

How can I make it vary?
This is the part of the macro that isn't working:

Application.Goto Reference:="R54C4" (cell that contains the address)
Selection.Copy
Application.Goto Reference:="R7C601" (this needs to be variable - tried pasting the copied cell address into the "goto" box, but if will only go to this address)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
This works for me.

Dim MyVariable As String
MyVariable = Range("D54").Value
Application.Goto Reference:=Range(MyVariable)
 
Upvote 0

Forum statistics

Threads
1,203,435
Messages
6,055,366
Members
444,781
Latest member
rishivar

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