Random selection paste after last row in VBA

wildsideuk

New Member
Joined
Sep 6, 2020
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
Hi all, any help appreciated.

I often need to produce simulated sales orders for a client with up to 10 seperate customers and up 20 products each (with up to 7 of each product). At present I have to do this one customer at a time, I have a macro that randomly selects 1 of 493 customers and then I have a msgbox to enter number of products which are randomly selected from 1300. Both the customer and the products aer on separate sheets but copd to single sheet with the products listed in columns K and quantity in L (I manually need to add this). I do this for all 10 random customers.

Is there any way to have excel take a random customer from sheet 1, however many products I entered from sheet 2, combine both in sheet 3 and then if I run the process again it adds the new data to the next empy rows? I need headers for this process too although I can add them as a final process if omited intially. Headers appear in all 3 sheets, sheet 3 headers are also present in sheets 1 & 2.
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Sulprobil

Board Regular
Joined
May 12, 2020
Messages
141
Office Version
  1. 2016
Platform
  1. Windows
This can be done fairly easily.
Google for sbGenerateTestData, for example.
Please provide some sample layout how you would like the result sheet to look like.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,528
Messages
5,596,690
Members
414,088
Latest member
rodriboraun

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
Top