+ Reply to Thread
Results 1 to 9 of 9

Running macro in multiple sheets

  1. #1
    Registered User
    Join Date
    06-18-2009
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    18

    Running macro in multiple sheets

    Hi,

    I have the following code to run an autofilter in multiple worksheets. The worksheets aren't consecutive, so I want to be able to name exactly what sheets I want the macro to run in, I will ultimately be naming alot more. Here is what I have so far:

    Please Login or Register  to view this content.
    The first line where I specify the sheets is not working. Thanks for any help
    Last edited by shak1; 06-18-2009 at 04:08 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Running macro in multiple sheets

    shak1

    try......

    Please Login or Register  to view this content.
    Last edited by pike; 06-18-2009 at 05:09 AM. Reason: ophs..left out the important bit
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Running macro in multiple sheets

    The first code dosent look right
    Please Login or Register  to view this content.
    looks correct
    Last edited by pike; 06-18-2009 at 05:28 AM. Reason: Tags

  4. #4
    Registered User
    Join Date
    06-18-2009
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Running macro in multiple sheets

    I am now getting a "Compile Error End With without With".

    Please Login or Register  to view this content.
    Last edited by shak1; 06-18-2009 at 05:49 AM.

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Running macro in multiple sheets

    Please Login or Register  to view this content.
    will have it

  6. #6
    Registered User
    Join Date
    06-18-2009
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Running macro in multiple sheets

    "Subscript out of range" error on the line:

    Worksheets(c).Select'added line

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Running macro in multiple sheets

    Your right


    use
    Please Login or Register  to view this content.
    I've tested this code and it will do s you require

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Running macro in multiple sheets

    if there is no data in the selected sheet or range it will error

    check to see if you have data in sheeets 13 and 15 in the ranges
    Please Login or Register  to view this content.
    added
    Please Login or Register  to view this content.
    so that if there is no data it moves on
    also are your sheets naamed "Sheet13" and "Sheet15"?

  9. #9
    Registered User
    Join Date
    06-18-2009
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Running macro in multiple sheets

    Will try that new advice, Thanks
    Last edited by shak1; 06-18-2009 at 06:38 AM.

+ 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