+ Reply to Thread
Results 1 to 10 of 10

VBA Combining Macros

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    St.Paul, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    37

    VBA Combining Macros

    Hi, I've got three macros. I need them to be done in this order.

    1.) The first macro deletes Rows 1, 2, and 3, and Columns A, B, and G throughout all of my sheets within a workbook. (The data is organized the same throughout). This is what it looks like:
    Please Login or Register  to view this content.
    2.) The second macro combines the newly trimmed data from all sheets and combines it all into a new sheet titled "Combined" Heres the code:
    Please Login or Register  to view this content.
    3.) I want the third code to look through the newly created "Combined" sheet and delete any Rows that have a blank in column B on this "Combined" sheet. Heres my code:
    Please Login or Register  to view this content.
    If someone could help me join these macros into one so that they all run, in this order, that'd be greatly appreciated! Simply adding them ontop of eachother doesnt seem to be doing the trick. Thanks so much!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: VBA Combining Macros

    Try this, it's not fully tested but it might help in some way..
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: VBA Combining Macros

    try this....if all the subs are in the same module this should work....also, I didn't the name of the second module, so I faked it....execute MyMain and it will "Call" it sub in turn

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  4. #4
    Registered User
    Join Date
    06-26-2015
    Location
    St.Paul, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: VBA Combining Macros

    Hi gmr4evr1,

    Your code is doing everything properly except for deleting the blank rows in Column B from in the new "Combined Sheet" Any ideas? Also, I'm wondering if i could have the "combined sheet" columns be auto adjusted for width too. Thanks so much!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: VBA Combining Macros

    If all your subroutines are tested and working, the best (and most practical) solution is judgeh59's. (Would have been my approach but he beat me to it .)

    No development or testing required.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Registered User
    Join Date
    06-26-2015
    Location
    St.Paul, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: VBA Combining Macros

    Quote Originally Posted by judgeh59 View Post
    try this....if all the subs are in the same module this should work....also, I didn't the name of the second module, so I faked it....execute MyMain and it will "Call" it sub in turn

    Please Login or Register  to view this content.
    Would I simply add this code to the beginning of the module with all of my subroutines in it?

  7. #7
    Registered User
    Join Date
    06-26-2015
    Location
    St.Paul, Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: VBA Combining Macros

    Hi TMS,

    Both methods seem to be working, all except for my third subroutine. After the data is trimmed and compiled, I want the third sub to auto adjust column width for A:D and I want it to delete any Rows that have a Blank cell in Column B. The code I've recorded is this, but it doesnt seem to be working.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: VBA Combining Macros

    Probably need to see some data.

    You don't need to select objects to work with them:

    Please Login or Register  to view this content.
    should work.

    Regards, TMS

  9. #9
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: VBA Combining Macros

    @TMS - thanks for the vote of confidence, so to speak....

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: VBA Combining Macros

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help combining macros
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2015, 09:33 AM
  2. [SOLVED] Combining 2 macros
    By bnwash in forum Excel General
    Replies: 5
    Last Post: 01-02-2015, 10:13 PM
  3. [SOLVED] Need help combining two macros
    By Bootkie2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2012, 11:22 PM
  4. Combining Macros
    By rocketboy13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-01-2011, 02:45 PM
  5. MACROS for combining .CSV to XLS...
    By pma101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2011, 11:16 AM
  6. combining Macros
    By xcelwannabee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2009, 09:02 PM
  7. [SOLVED] Combining macros
    By GarToms in forum Excel General
    Replies: 2
    Last Post: 02-09-2006, 08:35 AM

Tags for this Thread

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