+ Reply to Thread
Results 1 to 5 of 5

Subset of worksheets

  1. #1
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Subset of worksheets

    I have a workbook with lots of sheets, I'm only interested in a subset of sheet names. These I entered into a worksheet called MacroInfo in the same workbook. I want to loop through each worksheet and if it's name is one of the subset then do something.

    I have this code for a fixed set of sheet names
    Please Login or Register  to view this content.
    Now, trying to get the sheet names dynamically from the MacroInfo worksheet

    Please Login or Register  to view this content.
    But I get nothing. Even when I hard code the range to "G1:G8"

    Any ideas what I'm doing wrong?

    Thanks
    Last edited by jlt199; 07-29-2013 at 03:45 PM.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Subset of worksheets

    Please Login or Register  to view this content.
    Untested.
    Last edited by Solus Rankin; 07-29-2013 at 02:19 PM.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  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: Subset of worksheets

    If sheetNames is populated from more than one cell it will be a 2-dimensional array.

    So you would get an error here.
    Please Login or Register  to view this content.
    Why not loop through the sheet names?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: Subset of worksheets

    Thanks alot for your quick replies.

    Norie, I had to make a slight change to your code

    Please Login or Register  to view this content.
    Can I now extend this code to test that a sheet of that name exists before setting ws to it?

    I've tried using the function

    Please Login or Register  to view this content.
    But I can't get it to look in the right workbook, despite several different attempts. Are you able to help with this please?

    Thanks

  5. #5
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: Subset of worksheets

    Nevermind, I've got it working thanks

+ 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. Subset Sum Problem
    By smuzoen in forum Excel Tips
    Replies: 0
    Last Post: 07-05-2012, 09:55 AM
  2. Max value from column subset?
    By Carolina in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2011, 08:51 AM
  3. Saving subset of Worksheets
    By rtiltins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2008, 04:25 PM
  4. MAX Value of Column Subset
    By WeatherGuy in forum Excel General
    Replies: 5
    Last Post: 04-19-2007, 04:36 PM
  5. [SOLVED] How to enter symbols for subset or element of a subset in Excel?
    By rwcita in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2006, 05:30 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