Macro inconsistency

igdent

New Member
Joined
Oct 8, 2015
Messages
16
Hi all,
I am running a vba that copies from other workbooks and pastes into ThisWorkbook with offsets etc. There are 10 workbooks altogether and at the end of each run the vba is coded to return each workbook to "Sheet1". My problem is that the returning to Sheet1 works in 9 of the workbooks but does not work in the tenth. I took just that piece of code and pasted it into a module on the offending workbook and tried running it separately but it still does not work, yet works in the others.
This is the code (which I actually got from somewhere on this forum if I recall correctly):

Sub GoToFirstSheet()
On Error Resume Next
Sheets(1).Select
End Sub

But somehow I think the problem must be in the book itself. What could stop a book from running such a code without errors etc.?
Thanks in advance.
 
Oh, you're joking! It is too. How stupid of me! I didn't even think to check for that, even though you did mention it earlier. There were no hidden sheets on any of the others so I just presumed there were none on this one. Thanks so much. Hopefully I won't be so stupid in the future.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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