mercredi 16 mars 2016

VBA/Macro to generate random data based on dropdown/combobox

screenshot

Above is the screenshot of my layout so far. I have 2 combo boxes The first one has items (Person1, Person2, Person3) and the other one has (x1,x2,x3,x4,x5,x6). I also have one button for executing commands when everything is already functioning.

First combo box is linked to cell A1 Second combo box is linked to cell C1

I need to be able to generate random sample data based on what i have selected in the 2 combo boxes and the conditions are like this:

Let's say if Person1 and x1 is selected, I should get 4 random sample from data.xls only for rows that has (AA,BB,CC,DD,EE) and if I select Person1 and x2, I should get 7 random sample from data.xls

This photo contains the conditions that needs to be made to make things more clear: enter image description here

I want to be able to generate or get random sample from a workbook let's say data.xls and paste it to Random Sample worksheet by just selecting from the 2 combo boxes and one click of the button.




Aucun commentaire:

Enregistrer un commentaire