+ Reply to Thread
Results 1 to 2 of 2

Macro to run for Multiple worksheets

  1. #1
    Registered User
    Join Date
    03-13-2009
    Location
    London, England
    MS-Off Ver
    Excel 2016
    Posts
    98

    Macro to run for Multiple worksheets

    I need a Macro to perform the exact same task but for Multiple sheets. The Current Macro runs from "Net Positions" all the way upto "Net Positions(56)". Since I want to add more Net Positions(x) sheets, I need to loop the Macro. The current format just uses the same code over and over by just changing the name of the active worksheet. The workbook also contains sheets that dont need the macro to be run. Currently the Macro copies cells H18:CP27 and paste the values into cell H32:CP41. Then it sorts cells H32:CP41. Column H Highest to Lowest. Then Column I Highest to lowest then Column G A to Z.

    Ideally I need a minimum of 100 sheets i.e Net Positions-Net Positions(100) to run the same macro.

    Since the file was so big. I deleted Net Positions(4) - Net Positions(56).And also the sheets numbered 1,2,3 contain data which is linked to Net positions. I deleted 4-45
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to run for Multiple worksheets

    Perhaps like so, this will scan through all the sheets in your book an only run the sorting commands on sheets that have names that start with "Net"
    Please Login or Register  to view this content.
    I imagine the three sorting commands might be able to be consolidated into one sort command, too, but I'd need to see some real data. The sheet downloads with all #REF errors so far.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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