mercredi 25 octobre 2017

Multiple Checkboxes & Textboxes to Multiple row in Excelsheet using VBA

I'm trying to create a userform that tabulate multiple checkboxes and textboxes into multiple rows.

Here is my example form:

    Userform

    Date: 24/10/2017 <------------ Label  
    Branch: [] <------------ text box  
    Branch Name: [] <------------ Combobox  
    Address : [] <------------ text box  

    ☑ Error 1 [Size 1] [Quantity 1] <-------- Text box  
    ☑ Error 2 [Size 2] [Quantity 2] <-------- Text box  
    ☑ Error 3 [Size 3] [Quantity 3] <-------- Text box  
    ☑ Error 4 [Size 4] [Quantity 4] <-------- Text box  
    ☑ Error 5 [Size 5] [Quantity 5] <-------- Text box

    [submit] <- command button

Therefore, if I were to select checkbox error 1 and checkbox error 5, it would insert the values into 2 different rows respectively.

    For Example in excel sheet:  
    C1: Error 1 D1: [Size 1] E1: [Quantity 1]  
    C2: Error 5 D2: [Size 5] E2: [Quantity 5]

    and subsequently, if I were to select checkbox error 2 and checkbox 
    error 3 for the next entry, it would insert:  
    C3: Error 2 D3: [Size 2] E3: [Quantity 2]  
    C4: Error 3 D4: [Size 3] E4: [Quantity 3]

I do know that I have to use a "for each" loop but i'm unsure of how to implement it.

Please advice. Thank you very much




Aucun commentaire:

Enregistrer un commentaire