+ Reply to Thread
Results 1 to 9 of 9

Correcting Macro Run-Time error '9' - Subscript out of range

  1. #1
    Registered User
    Join Date
    08-19-2016
    Location
    Michigan, United States
    MS-Off Ver
    2016 and 365
    Posts
    7

    Correcting Macro Run-Time error '9' - Subscript out of range

    So, I am an average to above average Excel user but am trying to dabble into Macros to make my life easier. I'm trying to create this macro to take a report I pull in from SAP and format it to the way the Senior Management Team wants it in. I keep getting the "Run-time error '9': Subscript out of range" error. I have no clue how to debug this or even how to re-record the macro so that it will be successful. If I can get this macro to work it will save me SOOO much time. I appreciate any help or assistance this group can provide. Thank you in advance for your time.



    Please Login or Register  to view this content.
    Last edited by Cdub529; 08-19-2016 at 04:10 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Macro Headache......911

    Welcome to the board, Cdub.

    Please take a few minutes to read the Forum Rules about thread titles, and then amend yours accordingly, and then edit your post to wrap your code with CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-19-2016
    Location
    Michigan, United States
    MS-Off Ver
    2016 and 365
    Posts
    7

    Re: Macro Headache......911

    Thank you. I think I fixed everything.

  4. #4
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    Can you upload a workbook so I can trouble shoot please

  5. #5
    Registered User
    Join Date
    08-19-2016
    Location
    Michigan, United States
    MS-Off Ver
    2016 and 365
    Posts
    7

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    The macro works with "report Cleanup" attachment but not the "Khary Report" attachment.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-19-2016
    Location
    Michigan, United States
    MS-Off Ver
    2016 and 365
    Posts
    7

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    at least on my system it works properly.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    You can replace ActiveWorkbook.Worksheets("Report Cleanup") with ActiveWorkbook.Sheets(1) the macro is trying to find a sheet named "Report Cleanup" in the "Khary report.xlsx" workbook, and it's failing to find it.

    Alternative you could rename the data sheet in "khary report.xlsx" to Report Cleanup.

    Attached modified code.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-19-2016
    Location
    Michigan, United States
    MS-Off Ver
    2016 and 365
    Posts
    7

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    Oh wow! I knew it had to be something simple. One more thing to add to my Excel knowledge. Thank you so much, you've saved a lot of time out of my weeks and life.

  9. #9
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Correcting Macro Run-Time error '9' - Subscript out of range

    You're welcome sir.

+ 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. Headache with formula
    By crazytimechris in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2015, 10:25 AM
  2. Massive =IF headache
    By paradox34690 in forum Excel General
    Replies: 7
    Last Post: 03-22-2012, 09:08 PM
  3. Formula headache!
    By JoeyG in forum Excel General
    Replies: 0
    Last Post: 04-03-2007, 04:18 PM
  4. what a headache please help
    By Crasher in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-28-2006, 07:02 PM
  5. That wonderful day of 2/29 gives me a headache...
    By Tibbets in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2006, 02:15 PM
  6. Multiple Userform Macro Headache
    By larryhl@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2006, 11:05 AM
  7. headache! :) unique_id's
    By cjjoo in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2005, 10:24 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