Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Subscript Out of Range" Errors For Ranges
I'm in the process of altering someone else's code. He's got a code module
that with code that refers to ranges by name. For instance, Range("aggregate_loan_monthly_results").Clear This code was originally called via a macro button on a worksheet. I've added a User Form that's calling this code instead, and when it gets to that line, it errors out with "Subscript out of range". It still works fine if I use the button. What's the deal? -- Hmm...they have the Internet on COMPUTERS now! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Subscript Out of Range" Errors For Ranges
MDW wrote:
I'm in the process of altering someone else's code. He's got a code module that with code that refers to ranges by name. For instance, Range("aggregate_loan_monthly_results").Clear This code was originally called via a macro button on a worksheet. I've added a User Form that's calling this code instead, and when it gets to that line, it errors out with "Subscript out of range". It still works fine if I use the button. What's the deal? Range can be defined on a sheet, not global, so check if you have the same sheets active when you run macro from button and from user form. Go to Insert/Name/Define , find your range and check if you see sheet name close to name or not. If there is a sheet name close to range name it means that name is defined as local and is not visible when other sheet is active. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Subscript Out of Range" Errors For Ranges
It could also be the workbook with the range is not active. That will
produce an error. What is different about the environment when you click the button versus when the userform is active and that line of code is executed? "MDW" wrote in message ... I'm in the process of altering someone else's code. He's got a code module that with code that refers to ranges by name. For instance, Range("aggregate_loan_monthly_results").Clear This code was originally called via a macro button on a worksheet. I've added a User Form that's calling this code instead, and when it gets to that line, it errors out with "Subscript out of range". It still works fine if I use the button. What's the deal? -- Hmm...they have the Internet on COMPUTERS now! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Subscript out of range" error for: Workbooks("Test1.xls").Save | Excel Programming | |||
FileCopy Command Giving "Subscript Out of Range" Error Message | Excel Programming | |||
"Subscript out of range Runtime Error 9" | Excel Programming | |||
SaveAs "subscript out of range" error (COM - SOAP) | Excel Programming | |||
SaveAs "subscript out of range" error (COM - SOAP) | Excel Programming |