+ Reply to Thread
Results 1 to 3 of 3

Multiiple Worksheet Loop Macro only Looping on 1 sheet

  1. #1
    Registered User
    Join Date
    09-18-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    4

    Multiiple Worksheet Loop Macro only Looping on 1 sheet

    Good Morning,

    I have a Macro which calls 2 submacros to create and names multiple worksheets. This portion is working. Additionally, I have 2 sub Macros that I want to process through all the worksheets in the file (one is for sorting and subtotaling and one for print formatting). Unfortunately, the Looping macro I am using is looping the same
    worksheet data over and over instead of one time for each worksheet. Since the number of spreadsheets will be variable from file to file, I can't just define the spreadsheets once. Can someone help me with the correct code so that the Sub macros for Sorting&Subtotaling and Print formatting will work on any number of worksheets?

    Thank you in advance!
    LC

    ---------------------------------------------------------------

    Please Login or Register  to view this content.

    Moderator Edit:

    Welcome to the forum, lscarstens.

    Please notice that code tags have been added to your post. The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.

    This is the second time in 2 days that you've been reminded.
    Thanks.
    Last edited by Cutter; 09-20-2012 at 02:29 PM. Reason: Added code tags

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Multiiple Worksheet Loop Macro only Looping on 1 sheet

    Hi, LC,

    please use Code-tags to make your code worth looking at.

    You stay on the very same sheet throughout your macro,maybe change it like
    Please Login or Register  to view this content.
    I would avoid the Activate and pass a parameter (in this case the index of the worksheet) to the procedures.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    09-18-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Multiiple Worksheet Loop Macro only Looping on 1 sheet

    Buon giorno!

    Thank you, Holger. I had to delete my original "Sheet1" data sheet but then your suggestion worked. I was going to include the deletion of Sheet1 anyway - I just did it before instead of at the end. This is awesome!

    Best regards!

    PS - I apologize for not using Code-Tags - will use in the future - I am new to online help

+ 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