Runtime Error 9

whyme6181

New Member
Joined
Oct 26, 2009
Messages
47
Hi. I have a macro that for whatever reason refuses to switch back to the starting worksheet. It doesn't matter which you start from it won't go back to it. For example if you start at sheet 1 it will switch to all sheets except sheet 1. If you start at sheet 3 it will switch to all sheets except sheet 3. This makes no sense to me and I need this to work in order to do my job. This worked just fine for me up until today when I got a new laptop, but my coworkers had trouble running it. Now I am just like them. Here is the test code:

Code:
Sub test()
Worksheets("List").Select
Worksheets("MSI").Select
Worksheets("MMI").Select
Worksheets("Data Sets").Select
Worksheets("Arrays").Select
Worksheets("1").Select
Worksheets("LIST").Select
Worksheets("Arrays").Select
Worksheets("MSI").Select
End Sub

Please let me know if there is some fundamental I am missing or something. This just doesn't make sense to me.

Thanks
 

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.
That looks like it should work but why do you need to select a sheet to start with?
 
Upvote 0
My macro takes info from one sheet cross references with a system and then back to a table on another sheet and then inputs the result on the original sheet. However, I can't get the macro to go back to the original sheet.
 
Upvote 0
You don't need to select a sheet in order to work with it

Code:
With Sheets("List")
    .Range("A1").Value = "AArgh!"
End With
 
Upvote 0
Actually, in this instance I do, because it is a loop and all of the source info is on the first sheet, so eventually it has to get back to the first sheet to select the next batch of info. Or is there another way for me to do that?
 
Upvote 0
You still shouldn't need to select. For example to copy a range from one sheet to another

Code:
Sheets("Test").Range("A1:E10").Copy Destination:=Sheets("MSI").Range("A" & Rows.Count).End(xlUp).Offset(1)
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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