0

I have been tasked with converting our group over to Office 2013. One of the macro enabled Excel sheets is kicking an error that I cannot figure out.

Run-time Error 9 - Subscript out of range.

I debug and find the ONLY code that is highlighted:

W.Sheets("Sheet2") .Activate

This code seems pretty straight forward and I can't seem to find any other solutions after researching quite a bit.

Anyone have any ideas on troubleshooting?

It works fine for Office 2010 on multiple machines, in multiple locations - but in 2013 it doesn't matter which user runs it, or from where - it kicks this same error to everyone.

Thanks for any help you can provide since I'm new to supporting macros and it's been awhile since I programmed anything - I'm sure it's something very simple that I'm missing.

Community
  • 1
  • 1
Drew
  • 1
  • 1
  • 1
  • possible duplicate of [Subscript out of range run time error 9](http://stackoverflow.com/questions/24665691/subscript-out-of-range-run-time-error-9) – grovesNL Mar 24 '15 at 16:06
  • The error means what it says "Subscript Out of Range". There is no sheet named "Sheet2" within the Sheets collection. The name is the name which is displayed in the sheet tabs. It is not the "codename" which is displayed in the VBA IDE. – Axel Richter Mar 24 '15 at 16:32

1 Answers1

2

"Sheet2" doesn't exist.

The only other issue I see is the space between ("Sheet2") and .Activate, though that may just be a copy/paste issue.

FreeMan
  • 5,660
  • 1
  • 27
  • 53
  • I thought the same thing about Sheet2 and I was able to locate it.. and yes - issue with copy/paste.. there is no space between them. – Drew Mar 24 '15 at 16:47
  • Correct, no space. If you remove that and you're still getting an error, retype the worksheet name - both on the worksheet tab, and in your code. I've seen weird, non-printable characters get introduced that make things that _look_ like they match not actually match. – FreeMan Mar 24 '15 at 16:49
  • yea that was my fault - theres no space in between. so i guess its looking like Sheet2 is the culprit.. I will have to look more into this - thank you for your quick response! – Drew Mar 24 '15 at 16:51