+ Reply to Thread
Results 1 to 4 of 4

VBA for Array of sheet values

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    Connecticut, U.S.A.
    MS-Off Ver
    Excel 2010
    Posts
    52

    VBA for Array of sheet values

    Hey gents - I'm looking to automate a line of code to copy worksheets from a list of sheet values.

    Here is the code I got from the macro recorder:

    Please Login or Register  to view this content.

    Instead of adding all of the sheet names into the above code one by one, I'd like to refer to a list of sheet names found on a sheet called Lists!G2:G10 (this list could grow or shrink).

    How can I do this?

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: VBA for Array of sheet values

    Create a dynamic named range SheetNames, with nothing else in column G of Lists - with the refers to being

    =OFFSET(Lists!$G$2,0,0,COUNTA(Lists!$G:$G),1)

    or this, is your list has a header -

    =OFFSET(Lists!$G$2,0,0,COUNTA(Lists!$G:$G)-1,1)

    and use code like this:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA for Array of sheet values

    Maybe:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 10-17-2014 at 03:31 PM.

  4. #4
    Forum Contributor
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    227

    Re: VBA for Array of sheet values

    Or loop over thru:

    Please Login or Register  to view this content.
    If I've been of help, plz add reputation.

+ 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. copy entire excell sheet cells values into string array
    By laltoo2405 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 09:17 PM
  2. Finding Values Contained in an Array in a Sheet
    By sperry2565 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-26-2013, 04:33 PM
  3. Create an array based off values in another array - exclude blanks
    By clifton1230 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2013, 05:35 PM
  4. Replies: 3
    Last Post: 08-13-2012, 11:44 AM
  5. Filter sheet then assign values into array based on this filtered sheet
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 10:32 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