+ Reply to Thread
Results 1 to 14 of 14

Script Out of Range Error

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Script Out of Range Error

    Hello,

    I have a script that until this morning worked fine but now I am getting a "Script out of Range" Error. I have bolded the line that is causing problems. Anyone have any idea's why this is suddenly an issue?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Script Out of Range Error

    Is there a worksheet named 'LC Schedule' in the workbook that's just been opened?

    Also, where is this code located?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    Yes there is a worksheet with that name in the file that is being opened. Also this code is located in another workbook.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Script Out of Range Error

    Where in the other workbook?

  5. #5
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    Sorry not sure what your asking. Its on a dashboard tab - not the "LC Input" tab which is used in the code above

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Script Out of Range Error

    As far as I can see you would only get this error if the workbook being opened didn't have a worksheet with the exact name 'LC Schedule' or the code was located in the ThisWorkbook module of the workbook you are running the code from.


    PS You might want to lose all the Activate/Select stuff, for example.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    hmmm yeah I know that this all works because I have been using this code for weeks now and for some reason this just came up today. Thanks for taking a look! Anyone else have an suggestions?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Script Out of Range Error

    Nothing has changed?

    It's definitely the right workbook that the user is selecting in the dialog?

  9. #9
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    Yeah nothing has changed - I added script elsewhere and was trying to re-run the model and suddenly the error occured

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Script Out of Range Error

    Can you upload the file that's causing the problem when it's opened?

    You can scrub all the data from it.

    PS I don't mean scrub the data from the actual file, just open it, scrub the data, save under a new name and upload that.

  11. #11
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    Unfortunately no - to remove all sensitive data would take far too long. All I can say about it is there is definitely a worksheet "LC Schedule" which has the information I need on it.

  12. #12
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Script Out of Range Error

    Do you have any code trapping the activate event of that worksheet?
    Remember what the dormouse said
    Feed your head

  13. #13
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    ummm sorry romperstomper - im fairly new to vba and not sure what you mean by that

  14. #14
    Registered User
    Join Date
    07-18-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: Script Out of Range Error

    OK I seem to have fixed the issue, though I don't know why this worked. The model i'm using originally had 2 buttons: 1) to clear and 2) run model. This code was my attempt to consolidate that down to a single run button. When I originally wrote the code, I added the code to the model then deleted the 1st button, moving its procedures into the 2nd. This is what seems to have broken the code (again I have no idea why). I copied the same code into an earlier version of the model with both buttons in tact and it ran perfectly. I then tested removing the button and re-ran and was getting the above error. So I tried reversing the order of operations: I first removed the button from the model and then imported the code and now its working perfectly. So if someone can explain why removing a button (and I would like to emphasize that only the button was removed, no code was changed) would break code like this that would be very helpful. But for now im just happy it works. Thanks for the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Script out of Range Error
    By elevate_yourself in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-10-2014, 11:42 AM
  2. run time error 9: script out of range?
    By sanjayrshn.hzb in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-04-2014, 05:38 PM
  3. [SOLVED] Run Time Error 9 " Script out of range
    By vaibhav2312 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-10-2013, 08:10 AM
  4. Script Out Of Range Error at Logon
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2009, 05:52 PM
  5. Script out of range error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1