Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Checkboxes on a form (https://www.askmehelpdesk.com/showthread.php?t=537088)

  • Dec 23, 2010, 04:56 AM
    nismyl
    Checkboxes on a form
    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
  • Dec 23, 2010, 05:11 AM
    ScottGem

    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.
  • Dec 23, 2010, 06:57 AM
    nismyl
    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

  • Dec 23, 2010, 01:48 PM
    ScottGem

    Post your code, lets see what you have.

  • All times are GMT -7. The time now is 04:42 AM.