+ Reply to Thread
Results 1 to 18 of 18

Why do i get run-time error 9: subscript out of range error?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-01-2020
    Location
    London, uk
    MS-Off Ver
    365
    Posts
    87

    Re: Why do i get run-time error 9: subscript out of range error?

    To use active workbook, I would need to copy paste the macro to the new workbook each time. I wanna have the macro in the background in another workbook so whenever I open a new workbook, I can just execute it with a shortcut.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Why do i get run-time error 9: subscript out of range error?

    Quote Originally Posted by skhande2 View Post
    To use active workbook, I would need to copy paste the macro to the new workbook each time.
    No, you would not. It will refer to whatever workbook is active when the code is running, no matter which workbook the code is in. ThisWorkbook by contrast, as Trevor said, always refers to the workbook with the code in it.
    Everyone who confuses correlation and causation ends up dead.

+ 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. Error code "run time error 9: subscript out of range
    By iBennett93 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-28-2021, 05:03 AM
  2. VBA script error help: Run-time error'9': Subscript out of range.
    By TrinhNgocAnh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2018, 05:34 AM
  3. [SOLVED] Help with error run-time error '9" (subscript out of Range)
    By thong127 in forum Excel General
    Replies: 7
    Last Post: 05-02-2018, 02:17 PM
  4. [SOLVED] Run Time Error 9 - Subscript out of range
    By kersplash in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2018, 02:05 AM
  5. VBA Error - Run Time Error 9 - Subscript out if range
    By theskyscraper1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2017, 09:07 PM
  6. [SOLVED] Run-time error '9': subscript out of range - error occurs on multiple computers except one
    By BrettE in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2014, 11:19 PM
  7. Run time error 9 Subscript out of range
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2012, 03:30 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