+ Reply to Thread
Results 1 to 6 of 6

Nesting macros

  1. #1
    Registered User
    Join Date
    05-21-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    94

    Nesting macros

    I have two worksheets , each of which contains data relating to my sales on eBay The first one I created back in 2011 when I first started selling. At that time I created a macro which identified which items had sold and which ones had not (the sold items were identified with "1" in a cell while the unsold ones had blank cells). The whole lot was then linked to another worksheet by means of a formula which inserted "zzz" in all the cells in a row if that item was unsold. It next copy/paste valued all rows to remove the formulas before sorting the worksheet into alphabetical order so that all the cells containing "zzz" (unsold)were at the bottom. This works perfectly.

    A few years later I opened a second eBay account and created another worksheet to contain details of items sold and unsold. I designed a macro which goes through the process listed above for the first database for the 2nd database. What I would like to do now is to create a new macro which would carry out the process for both database worksheets then join them together to provide a final report which lists, in alphabetical order, all the items sold on both by eBay accounts. I assume that I could do this by nesting the first two macros (as described above) and adding more macro lines to combine the two (add the second database to the first) but I don't know how to do this.

    At a pinch I could create a completely new mega macro which would carry out the whole process with just the push of a single macro button, however to do so would be rather complicated and be vulnerable to human error in its construction.

    Is there a simple answer to this? I hope the foregoing is not too mystifying.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Nesting macros

    (You only refer to worksheets) Is everything in the same workbook?
    (same process adopted) Are the 2 "result" sheets formatted identically?
    Would simply consolidating the 2 "result" sheets give you what you need?

    This would update a 3rd sheet as described - latest position created when sheet is activated
    (it does not sort - your result sheets are already correctly sorted according to you)
    Please Login or Register  to view this content.
    Test in attached workbook
    - amend a few of the records
    - add records
    - sort based on date filter (Oldest to Newest to put ZZZ at bottom)
    - click on sheet Consol
    Attached Files Attached Files
    Last edited by kev_; 03-28-2018 at 04:05 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    05-21-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: Nesting macros

    Yes, all worksheets are in the same workbook and both are formatted identically. yes agin, the idea is to consolidate both worksheets. Each result worksheet will be sorted individually but the consolidated worksheet (I assume you mean the two worksheets joined together) would have to be re-sorted so that the consolidated worksheet was in alphabetical order.
    I will have a look at the lines you snt me in the morning. Thanks for your help.

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Nesting macros

    You should now be able to
    - create the Combo sheet (as per method in post#2)
    - sort the data in Combo sheet using to the method you are already using elsewhere

    Come back and let us know how you got on

  5. #5
    Registered User
    Join Date
    05-21-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: Nesting macros

    Thanks for your help. Whilst enjoying a coffee break a workaround occurred to which solved my problem. I would have tried your solution but would have had to spend a lot of time experimenting and understanding the logic. What I did was to create a macro which opened a worksheet containing formulas which linked cells to the corresponding cells in the main database. Cells which contained items which hadn't sold where populated with "zzz". That same worksheet contained formulas which linked cells to the corresponding cells in the second database (placing them at the bottom of the first lot. It then copied the resulting file to another worksheet, cop/paste valued them to remove the formulas and finally sorted the rows into alphabetical order. Voila!

    Thanks again for your help.

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Nesting macros

    Glad you arraived at a solution
    Please click ThreadTools@TopOfThread and mark thread SOLVED

+ 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. Multiple macros for several files that change weekly - where to store macros
    By janljan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-21-2018, 10:54 PM
  2. Replies: 2
    Last Post: 04-13-2017, 02:57 AM
  3. Nesting Function & Possibly Macros Needed?
    By Falcon459 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-24-2015, 08:42 AM
  4. Replies: 0
    Last Post: 06-09-2015, 09:30 PM
  5. Replies: 4
    Last Post: 02-26-2015, 06:10 AM
  6. Macros: Data cleaning macros not producing expected outputes.
    By bertlogdi1 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 06-17-2011, 06:52 AM
  7. [SOLVED] choose default macros Not Enabled / Macros Enable Setting
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2006, 08:10 AM

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