+ Reply to Thread
Results 1 to 6 of 6

Referencing Multiple Worksheets for same command

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Referencing Multiple Worksheets for same command

    I have the following code but want it so that instead of having to type With ThisWorkbook.Worksheets every time that it is just one line as in ThisWorbook.Worksheets("A) and ("B") and ("C") etc etc. It must be simple but I can't get it to work.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    10-08-2012
    Location
    Teesside, England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Referencing Multiple Worksheets for same command

    This might help - http://www.msexcelspreadsheet.com/vi...heets_vba.aspx

  3. #3
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Referencing Multiple Worksheets for same command

    What if the worksheets names aren't in any particular order which mine are not. I was just giving an example above. The names are actually Data1, Output2 and Analysis5

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

    Re: Referencing Multiple Worksheets for same command

    Try this.
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Referencing Multiple Worksheets for same command

    I tried that Norie. Got error message "Expected Array" and it highlighted "Ubound"

    EDIT: Just saw you edited posted and it works now.
    Last edited by ScabbyDog; 10-21-2012 at 06:56 AM.

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

    Re: Referencing Multiple Worksheets for same command

    Yes, there were a few typos in there.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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