Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Loop thru MSForms

$
0
0
Hi gurus

I would like to repeat this code 8 times using For Next loop. But I really don't know how to..


Code:

For x = 1 to 8
        Range("B" & 3 +x).Value = ASA
        Range("C"& 3 +x).Value = OrderForm.GoodName1.Value
        Range("D"& 3 +x).Value = OrderForm.OrderNum.Caption
        Range("E"& 3 +x).Value = OrderForm.GAmount1.Value
        Range("F"& 3 +x).Value = OrderForm.GPrice1.Value
        Range("G"& 3 +x).Value = OrderForm.GAmount1.Value * OrderForm.GPrice1.Value
        Range("H"& 3 +x).Value = IIf(OrderForm.CashOptBox.Value = True, "Cash", "Credit")
Next x

So, how to loop thru MSForms? Need smth like this. OrderForm.GoodName & x.Value

Viewing all articles
Browse latest Browse all 50090

Trending Articles