+ Reply to Thread
Results 1 to 20 of 20

Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

  1. #1
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Hey all,

    I am trying to hide/unhide multiple sheets with a checkbox click.. but there is an error that keeps on appearing,, (Error 9: Subscript out of range)

    Please Login or Register  to view this content.
    How i can solve this error?

    Thanks
    Last edited by nada.A; 04-12-2017 at 05:02 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    One/some of sheet(s) name spelled wrong or missing.

  3. #3
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    I am copying & pasting sheet names in the code to ensure their correct spelling.. All are correct.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Deleted........Not relevant
    Last edited by sintek; 04-12-2017 at 04:10 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Hi Nada.A

    Are you able to upload a sample workbook depicting sheet names

  6. #6
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Untitled.png

    this is what it look like

  7. #7
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    i want when i click the first checkbox (Lusail_DC1_2s) to unhide all 8 Green sheets named in the code... otherwise, kept hide.
    when i try to run the code it shows error 9

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Are you certain that the worksheet names are all correct
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    thank you for editing my code.. i have tried it but same error appears..
    i am very sure that all worksheet names are spelled correctly.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Best you upload your workbook ?

  11. #11
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    https://www.dropbox.com/s/02hlbpxjsf...list.xlsm?dl=0

    this is a link to download my workbook

    appreciate your help

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Try this
    Please Login or Register  to view this content.

  13. #13
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    The above code solves your problem

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Change to this:
    Please Login or Register  to view this content.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Please Login or Register  to view this content.

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    PS the reason for your error:
    Worksheets("Lusail_DC1_2S_UC") had an extra space Worksheets("Lusail_DC1_2S_UC ")

  17. #17
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    works perfectly !

    thank you so much sintek

  18. #18
    Registered User
    Join Date
    04-12-2017
    Location
    Qatar
    MS-Off Ver
    2016
    Posts
    10

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    i have been trying to solve this error for 4 days :/ ... shocked for how simple my mistake was ... thank you for your time sintek and jindon

  19. #19
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Pleasure nada.A

    If you are happy with result, please mark thread as solved and perhaps add a rep point by clicking star *Add Reputation...

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Error 9: Subscript out of range.. when hiding/unhiding multiple sheets

    Why so lengthy codes?
    See my post #15

+ 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. Hiding/Unhiding Multiple Sheets
    By excel_126 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2015, 02:50 AM
  2. [SOLVED] Consolidate multiple workbook sheets to one file - subscript out of range error?????
    By Crawfinator1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 06:03 PM
  3. Hiding/unhiding sheets
    By nkburm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2010, 04:07 PM
  4. Hiding/unhiding sheets
    By nkburm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2010, 03:49 PM
  5. [SOLVED] Hiding and Unhiding Sheets
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2006, 10:40 AM
  6. [SOLVED] Hiding and unhiding sheets
    By D.Hay in forum Excel General
    Replies: 2
    Last Post: 12-10-2005, 12:00 PM
  7. Hiding/Unhiding multiple sheets in VBA?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2005, 06:57 AM

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