Application.Goto error 1004

JLHpgs

New Member
Joined
Jan 24, 2014
Messages
3
Hi,
I am new to VBA and would be grateful for your help please. What is wrong with this that it gets an error:

Application.Goto Reference:="INDIRECT(CELL(""address"",OFFSET(R1R3,MATCH(MAX(C:c),C:c,0)-1,0)))"

The purpose is to find the maximum value in column c and move the cursor to that cell.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
What exactly does the formula return?

Also, in the formula you have R1R3, what range is that supposed to refer to?
 
Upvote 0
Thanks Norie.

If I type this formula into the Goto dialogue in a worksheet it takes me to the cell I want.
When I try to run it in VBA is gives Run time error 1004, reference is not valid

Apologies, R1R3 was mistyped in the post, it should have been the cell address which should perhaps be in R1C3 format? The formula I have is:
=indirect(CELL("address",OFFSET(C1,MATCH(MAX(C:C),C:C,0)-1,0)))
 
Upvote 0
Try removing INDIRECT from the formula and using Evaluate to get the cell address
Code:
strGoto = Evaluate("=CELL(""address"",OFFSET(C1,MATCH(MAX(C:C),C:C,0)-1,0))")

Then use the address with Range.
Code:
Application.Goto Range(strGoto)
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

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