简体   繁体   English

运行时错误9下标超出范围

[英]Runtime Error 9 Subscript Out of Range

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. 我的任务是将我们的小组转换为Office2013。启用宏的Excel工作表之一正在踢一个我无法弄清楚的错误。

Run-time Error 9 - Subscript out of range. 运行时错误9-下标超出范围。

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. 它适用于多台计算机,多个位置的Office 2010,但在2013年,无论是哪个用户运行,或从何处运行,它都对所有人产生相同的错误。

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. 感谢您提供的任何帮助,因为我是新来的支持宏的人,而且自从我编写任何程序以来已经有一段时间了-我确信这很简单,我很想念。

"Sheet2" doesn't exist. “ Sheet2”不存在。

The only other issue I see is the space between ("Sheet2") and .Activate , though that may just be a copy/paste issue. 我看到的唯一另一个问题是("Sheet2").Activate之间的空格,尽管这可能只是复制/粘贴问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM