+ Reply to Thread
Results 1 to 8 of 8

more flexible way to select multiple sheets

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    more flexible way to select multiple sheets

    Hello,

    I need to add sheets every month to the workbook that holds these tabs. is there a better way of coding this selection? it is basically selecting from the 5th sheet to the second last sheet in the workbook, I hope there is something that I can use so I don't have to manually update the array everytime a sheet is added or deleted


    Sheets(Array("7 Bond", "7595 Markham", "86 Woodbridge", "90 Colier", _
    "112 Woodbridge", "3905 Major Mack", "Strollery Pond", "4700HWY", "South Town", _
    "9088 Yonge", "9205 Yonge", "4800 HWY 7", "200 Woodbine", "9560 Markham", _
    "180 Enterprise", "9909 Pine Valley", "481 Rupert", "460 Adelaide", "50 Curzon", _
    "9390 Woodbine", "3865 Major Mack", "65 YOUNG", "135 YORKVILLE", "135 Wellington", _
    "8 Esplanada")).Selectthanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,342

    Re: more flexible way to select multiple sheets

    Try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: more flexible way to select multiple sheets

    Thank you so much TMS, this works perfectly!!

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: more flexible way to select multiple sheets

    Or
    Please Login or Register  to view this content.
    Congratulations with the Raptors' NBA Championship
    Last edited by jolivanes; 06-18-2019 at 07:59 PM. Reason: Congrats added

  5. #5
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: more flexible way to select multiple sheets

    wow amazing many thanks!

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: more flexible way to select multiple sheets

    In case you run the previous code while in a Sheet other than one of the Sheets to be selected, maybe following would be better as the active Sheet will be part of the selection.
    If one of the Sheets to be selected is your active Sheet, you're good to go with the previous suggestion.
    Otherwise just stick with Trevor's suggestion. No problems there.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: more flexible way to select multiple sheets

    ok got it! it amazes me how much help I've received from awesome people like you guys!!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,342

    Re: more flexible way to select multiple sheets

    You're welcome.

+ 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. Replies: 4
    Last Post: 11-25-2018, 05:34 PM
  2. Select a cell at random based on multiple selection criteria across multiple sheets.
    By scottyms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2016, 09:44 AM
  3. [SOLVED] SumIf - multiple flexible criteria
    By Joop Westland in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-26-2015, 02:12 PM
  4. [Question] Sumifs multiple sheets with flexible sheets reference
    By tranhaithang in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-29-2014, 04:53 AM
  5. [SOLVED] How to Deselect Multiple Ranges on Multiple Sheets After Select & Clear
    By catnam in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-20-2014, 02:12 PM
  6. How to select multiple sheets at once
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2014, 10:43 AM
  7. [SOLVED] VBA select multiple sheets
    By WackoV in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-28-2013, 10:13 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