+ Reply to Thread
Results 1 to 6 of 6

Macro Errors that no one else is getting?

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Macro Errors that no one else is getting?

    Hi everyone, i have a macro file (X) which draws data from 2 other excel files Y and Z. It then makes changes to file Y, leaving Z untouched.

    The way to use it is to open X Y Z and run the macro from Y. However, an error message pops up when i'm running the second part of the macro

    Run time error 9, subscript out of range

    on debugging, i find the error occurring at this line:

    Please Login or Register  to view this content.
    does anyone know what's happening? my friends tell me it runs fine on their computers, but i cant get rid of this error. does it have to do with excel error-ing when trying to find the last filled cell? thanks for the help!

  2. #2
    Registered User
    Join Date
    06-28-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro Errors that no one else is getting?

    i figured out the problem - turns out that hiding my file extensions does the trick. any idea why?

    i'm guessing the workbook referenced in the code does not have a .xls extension, can anyone confirm this?

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro Errors that no one else is getting?

    confusing information:

    error is occurring in this line
    and then you show 2 lines

    Solution:
    Please Login or Register  to view this content.
    The error message indicates whether:
    - there's no Workbook "Surgeon Allocation.xls"
    or
    - there's no sheet "Sheet1"
    Last edited by snb; 07-11-2011 at 03:28 AM.



  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,294

    Re: Macro Errors that no one else is getting?

    FYI, if you use:
    Please Login or Register  to view this content.
    then it will work whether extensions are shown or not.
    Remember what the dormouse said
    Feed your head

  5. #5
    Registered User
    Join Date
    06-28-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro Errors that no one else is getting?

    Quote Originally Posted by snb View Post
    confusing information:

    error is occurring in this line
    and then you show 2 lines

    Solution:
    Please Login or Register  to view this content.
    The error message indicates whether:
    - there's no Workbook "Surgeon Allocation.xls"
    or
    - there's no sheet "Sheet1"

    sorry what i meant was the error was in the first line. i just showed the second line for clarity. in fact, the code does not have the .xls, so it should read

    Please Login or Register  to view this content.
    does this mean that the macro will not work if i set file extensions to be visible in windows?

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro Errors that no one else is getting?

    Please read the answers carefully.....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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