+ Reply to Thread
Results 1 to 6 of 6

simplifying macro to repeat steps in every sheet

  1. #1
    Registered User
    Join Date
    02-27-2009
    Location
    ma
    MS-Off Ver
    Excel 2003
    Posts
    35

    simplifying macro to repeat steps in every sheet

    i have a book set up with a few sheets with info seperated out and then a sheet contianing everything. i have a macro set up to copy and paste from one sheet into a collection sheet, and then go thru and sort all the sheets.

    in my macro, i have a section for each indivitual sheet. i want to make it so it goes thru and just performes the task for all of them. i need this done so if we add more sheets in later, the macro doesnt have to be edited...

    below is my macro





    Please Login or Register  to view this content.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: simplifying macro to repeat steps in every sheet

    You don't need to select the sheet or range
    Please Login or Register  to view this content.
    Last edited by royUK; 05-28-2009 at 10:21 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-27-2009
    Location
    ma
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: simplifying macro to repeat steps in every sheet

    compile error: invalid or unquilifed reference

    .UsedRange is highlighted

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: simplifying macro to repeat steps in every sheet

    I've amended the previous code

  5. #5
    Registered User
    Join Date
    02-27-2009
    Location
    ma
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: simplifying macro to repeat steps in every sheet

    run-time error 1104
    debug

    Please Login or Register  to view this content.
    is highlighted yellow...

    help says:

    Ambiguous selection

    Either you have not selected a keyword or you have requested Help on a component of the integrated development environment (IDE). If you were trying to select a keyword, try reselecting a single keyword. If you were trying to get information on the IDE, click one of the following:

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: simplifying macro to repeat steps in every sheet

    Hello roth_nj,

    The named argument Key1 needs to be qualified with the worksheet variable ws, otherwise Excel assumes the range is on the active sheet. Also the active sheet should be excluded from the sorting loop.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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