+ Reply to Thread
Results 1 to 6 of 6

runtime error 9 subscript out of range

  1. #1
    Registered User
    Join Date
    09-18-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Angry runtime error 9 subscript out of range

    Hello Forumers!

    I would like to ask your help as I am struggling with this case for days and I cannot figure out what can cause this "runtime error 9 subscript out of range error". I would give some detail before the code.

    There are two files "A.xlsm" and "B.xls". File "A" is open (this is where I would like to run my macro from on file "B") and "B" should be opened and a specific worksheet called "data" should be activated and copied every data from that sheet row by row to file "A" if a colum value is a special word. In file "A" at the start I create a sheet with the current date which is important for me to stay this way. This sheet is totally empty.

    The code:

    Please Login or Register  to view this content.
    If there would be any guesses , hints or advice I would really appreciate it! I hope my description can be used to guide you to my problem.
    Last edited by Ted871; 09-20-2013 at 02:32 AM.

  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: runtime error 9 subscript out of range

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-18-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: runtime error 9 subscript out of range

    Is it ok this way?

    Thanks for the warning!

  4. #4
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: runtime error 9 subscript out of range

    Hi ted...

    i guess you are facing errors at activate section..
    just few suggestion..

    instead of using Window object try to use Workbook object..

    Please Login or Register  to view this content.
    now whenever you need to switch between windows / workbook..
    simply use..

    Firstfile.activate or secondfile.activate
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  5. #5
    Registered User
    Join Date
    09-18-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: runtime error 9 subscript out of range

    Hello Roy!

    Thanks for the answer I modified my macro by your example and it runs well.
    However I found another error during the run, I added a watcher on my "Intlastrow" variable and it always gets only one value 1.
    I already fixed it and step through my problem!

    Thanks for your help !

    P.S: You got your reputation from me Have a nice day!

  6. #6
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: runtime error 9 subscript out of range

    Hi Ted..

    Thanks for feedback.. and rep..

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Runtime error 9: subscript out of range..
    By daveyc18 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-19-2013, 03:02 PM
  2. Runtime error '9' Subscript out of range
    By mickinho in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2013, 03:00 AM
  3. Runtime Error 9: Subscript out of Range
    By murugavelmsc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2011, 12:33 AM
  4. [SOLVED] Runtime Error '9' Subscript out of range HELP
    By Brandon Johnson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2006, 01:50 PM
  5. Runtime Error 9 Subscript out of Range
    By TQO23 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-02-2005, 09:42 PM

Tags for this Thread

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