+ Reply to Thread
Results 1 to 3 of 3

Macro - Run Time Error 9 (Subscript out of range)

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Post Macro - Run Time Error 9 (Subscript out of range)

    Hello to everyone and in need of your HELP. 

    Created this macro that basically formats a report that we downloaded from a source. I shared it to other users but when they tried running the macro they are getting a 'Run Time Error '9' Subscript out of range'.

    I click Debug and it highlights the following line in my macro.

    ActiveWorkbook.Worksheets("Previous_Day_Summary_and_Detail").AutoFilter.Sort. _SortFields.Clear

    Any help is sincerely appreciated.


    Please Login or Register  to view this content.
    Last edited by Joshdm0716; 01-26-2014 at 01:43 AM.

  2. #2
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Macro - Run Time Error 9 (Subscript out of range)

    gave you tried something as simple as
    Please Login or Register  to view this content.
    Or create a little macro to ensure that there aren't any filters or sorts already applied to the range, it's struggling with removing filters that don't exist. There's loads of options available to resolve this type of issue. Is it possible for you to create a stripped out version of the file you are working on ? Just keep the code, but remove any sensitive data from the worksheets
    Last edited by ThirtyTwo; 01-26-2014 at 02:38 AM.

  3. #3
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Macro - Run Time Error 9 (Subscript out of range)

    Yup, subscript outta range is your code looking for something that you told it was available, but isn't. Filter, Sheet, Range, Cell..... something.

    I think Excel doesn't like how you are calling your worksheet.
    Try this:
    Please Login or Register  to view this content.
    The on Error thing will skip the Error, but not fix the problem, if there is one.
    I use it as a last result.
    Just guessing.

    Good Luck.

    dirty
    Last edited by dlow; 01-26-2014 at 03:55 AM.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro - Run Time Error 9 (Subscript out of range)

    Run Time Error 9 (Subscript out of range)
    usually means the object you are trying to access does not exist in the collection. It is highly likely the sheet does not exist in sheet collection, or there is a typo. Check if you have a sheet named "Previous_Day_Summary_and_Detail" in the work book you are working on.

+ 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. Run Time Error 9: Subscript out of Range
    By DanManly in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 11-15-2012, 03:07 PM
  2. Run-time error '9' - Subscript out of range
    By mgphill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2012, 10:08 AM
  3. Run Time Error 9 Subscript out of Range
    By Petrolcb41 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-26-2010, 08:43 PM
  4. fix a macro that gets a run-time error '9' subscript out of range
    By kellys in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2006, 03:55 PM
  5. Run time error 9 : Subscript out of range
    By JAtz_DA_WAY in forum Excel General
    Replies: 6
    Last Post: 08-29-2005, 03:26 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