Log in

View Full Version : Checkboxes on a form


nismyl
Dec 23, 2010, 04:56 AM
Guys, How are you? I need some help.

I have made a userform that have checkboxs. Each checkbox is representing the name of spreadsheet that a user may export or move to any other worksheet.

Suppose there are three spreadsheets in an excel file. "A, B and C". I have made a userform that shows shows,

Checkbox1 = A
Checkbox2 = B
Checkbox3 = C

CmdButton "Export"

If user will check on "A" and "C". Then only the checked sheets should be selected and exported.

Direct code: Sheets(Array("A","C")).Select

Please help me how should I define such array.

Thanks

ScottGem
Dec 23, 2010, 05:11 AM
First its not a good idea to piggyback your question on someone else's. This can lead to confusion. You should start a new thread. So I've moved your question to its own thread in the appropriate forum.

I would use a For... Next loop for this, checking to see if each the checkbox is checked then doing your export if it is.

nismyl
Dec 23, 2010, 06:57 AM
My Apologies Scott, I shouldn't have post on someone else's thread.

I have tried to use For.. Next loop but I am unable to use it properly.

The scenario is that there are 3 sheets. If I have checked only 2 of them then only these two sheet will export. It means that the selection array will re-define every time. Please Help.

Thank

ScottGem
Dec 23, 2010, 01:48 PM
Post your code, lets see what you have.