+ Reply to Thread
Results 1 to 5 of 5

Array that selects multiple sheets based on cell string

  1. #1
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Array that selects multiple sheets based on cell string

    I have a macro that publishes multiple sheets to a single pdf - it works fine

    The range of sheets will depend on the task I'm doing so I'm trying to write code that will be responsive

    I have a cell that creates the sheet names of the required sheets and concatenates them into a string eg

    "Cert1", "Cert2", "Cert3", "Cert4"

    This result appears in N15 and I'm trying to use this string below - everything I've tried so far has been 'subscript out of range' at the line "Sheets(Array(i)).Select"

    Any help gratefully received

    Please Login or Register  to view this content.

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

    Re: Array that selects multiple sheets based on cell string

    Hi, if you could provide a sample workbook (remove any personal or confidential information) that would help us to better solve for your use case, thank you

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

    Re: Array that selects multiple sheets based on cell string

    Something like this might work in this case.. (see attached)
    Attached Files Attached Files

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Array that selects multiple sheets based on cell string

    In N15 put this.
    Please Login or Register  to view this content.
    Then code would be like...

    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  5. #5
    Forum Contributor
    Join Date
    06-17-2015
    Location
    Norwich, England
    MS-Off Ver
    2016 (Office 365)
    Posts
    103

    Re: Array that selects multiple sheets based on cell string

    Spot on! Many thanks CK76

+ 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. Select multiple sheets(array) if sheet names are from cell value or string
    By marvay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2018, 11:26 PM
  2. [SOLVED] apply error handeling if user selects wrong file based on pre-defined sheets
    By carissa7 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-18-2018, 09:28 PM
  3. Replies: 1
    Last Post: 04-12-2014, 04:03 PM
  4. [SOLVED] Populating a cell based on what the user selects from a drop down
    By Chuck_N in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-07-2014, 12:54 PM
  5. multiple string dates in cell, to array, and manipulate single elements
    By willara23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 07:48 PM
  6. [SOLVED] Return matching string in array if cell contains string contained in the array
    By AaronsZ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2013, 01:55 PM
  7. Iterate thru sheets in workbook; take action based on text (string) value in cell
    By Trebormac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2007, 10:18 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