+ Reply to Thread
Results 1 to 6 of 6

selecting sheets defined in an array

  1. #1
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Red face selecting sheets defined in an array

    Right now I have a loop that selects sheets in the workbook like this:
    Please Login or Register  to view this content.
    Instead of selecting all sheets 2-100, I need only to select specific ones. So in the first sheet in cells P1:P100, I have which worksheet numbers (can be names vs. numbers as well) need to be selected. Some cells will have a number and some will not. So for example, cell P1 has 1, P2 is empty, P3 empty, P4 has 4, P5 has 5 and so on. How can I select only those sheets that are identified in column P? I'm guessing I need to refer to range P1:P100 as a vector and delete blanks from it, then select only those sheet numbers(or names) that are in the vector. Just not sure how to do that.

    Thank you
    Last edited by luv2glyd; 11-27-2015 at 09:33 PM.
    You either quit or become really good at it. There are no other choices.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: selecting sheets defined in an array

    Hi luv2glyd,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: selecting sheets defined in an array

    What do you want to do with the selected sheets?
    If posting code please use code tags, see here.

  4. #4
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: selecting sheets defined in an array

    Hi Robert, thank you for the code! Works perfectly for what I need and saves a lot of time.

    Norie, I actually have 1000 sheets with data in them and need to paste over some formulas into specific ones depending on other variables. First I copy the formulas, then select desired sheets and paste - so far the most efficient way I found.
    Last edited by luv2glyd; 11-27-2015 at 09:34 PM.

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: selecting sheets defined in an array

    I actually have 1000 sheets
    In my humble opinion a workbook should not have anywhere this number of sheets. There must be a more efficient way of doing things.

    In any case, thanks for marking the thread as solved and for the rep

    Robert

  6. #6
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: selecting sheets defined in an array

    Lol. That's the only way of doing what am I doing.... that I know of so far. Tomorrow it maybe completely different, lol. 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: 5
    Last Post: 08-19-2015, 07:10 PM
  2. Copy, paste, replace- user defined range in all the defined sheets
    By aganesan99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2014, 12:28 PM
  3. Sheets(i).Select gives App-defined or Obj-defined error
    By torrmundi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-04-2013, 04:11 PM
  4. [SOLVED] Subscript error from Selecting array of sheets
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2012, 03:13 AM
  5. Integer defined array vs variant defined array ..error making assignment to integer
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2011, 01:48 PM
  6. Selecting sheets with an array of names
    By Mestlol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2010, 08:48 AM
  7. Selecting an array with a varying number of sheets
    By cbjorgol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2008, 09:41 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