Joining several macros into one

kafka

New Member
Joined
Jun 2, 2012
Messages
42
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.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
you wouldnt want to combine macros.
Macros should be like books on a shelf,
1 macro does this,
another macro does that.
Call the one you want by picking it off the shelf.

If you mean put macros from 2 different workbooks,...
then :
put the macro in your PERSONAL workbook and you can run it in any workbook.


in VBE, in the left project pane, if you do not see PERSONAL.xlsb, then create one by:
select an empty spreadsheet
click RECORD MACRO,
change STORE MACRO IN, to PERSONAL MACRO WORKBOOK
click OK
click any cell
click STOP RECORDING
press ALT-F11 (vbe)


now you can see the personal workbook,
paste any macro in here and you can run it from any workbook.

in the project window, (far left) , drag the MODULE from the various workbooks into the PERSONAL workbook. Save.
Now all macros are 'combined' into 1 workspace and can be run in any workbook.




if you do not have the Macros available, turn on the DEVELOPER tab,
menu: file,options, customize ribbon,
in the far right pane,checkmark DEVELOPER.
OK
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top