Method Goto of Object Application Failed - RunTime Error 1004

beloshi

New Member
Joined
Jul 5, 2018
Messages
29
Hello Excel Gurus,

I am running the following code to do a simple task which is to bring all the sheets in the Workbooksheet to Position A1 and if there are scroll in the other sheet bring them to original scroll position with Columns like A... B...C ....D....E... etc etc.

I am getting the following Error although it is running in the other sheets but there is a particular sheet in which its throwing error : "Method Goto of Object Application Failed - RunTime Error 1004"


Code:
Sub Position()


Dim ws As Worksheet


For Each ws In Worksheets
    Application.Goto Reference:=ws.Range("A1"), Scroll:=True
Next


End Sub

Kindly Help would be really appreciated.

Best Regards and thank you in advance.

Beloshi.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Are any of the sheets in the workbook hidden?
 
Upvote 0
Are any of the sheets in the workbook hidden?

Yes Thank you I fixed it. There was a hidden sheet in the workbook.

Code:
Sub Position()


Dim ws As Worksheet


On Error Resume Next
For Each ws In Worksheets
    Application.Goto Reference:=ws.Range("A1"), Scroll:=True
Next
On Error GoTo 0
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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