Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
On a form I have some 5 textboxes with names txtrefno1, txtrefno2, ... to txtrefno5. I also have a textbox with the name txtrefno. Now I want to loop through the textboxes, and put the values in a table. So far, my code looks like this: r = Selection.CurrentRegion.Rows.Count For i = 1 To revs Dim b As Control, c As Control Set b = Me.txtRefno Set c = b & i ActiveCell.Offset(r, 0).Value = Me.txtRefNo1.Value ActiveCell.Offset(r, 1).Value = Me.lblNewAssignment.Caption ActiveCell.Offset(r, 2).Value = c.Value ActiveCell.Offset(r, 3).Value = Me.cboLSP.Value ActiveCell.Offset(r, 4).Value = Me.cboLaneID.Value ActiveCell.Offset(r, 5).Value = Me.cboCTM.Value r = r + 1 Next i You see that I'm hoping to create me.txtrefno1 ( and me.txtrefno2 etc, depending on the value in varaible revs ) with the line set c = b & i This however will not work. Is there a way to let Excel understand that I want to refer to an existing textbox where the name has to be created in code? Please, the loop would save a lot of extra code. Any help is greatly appreciated. Tanks in advance, Sybolt |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop through textboxes on a userform?! | Excel Programming | |||
returning back to loop check condition without completing the loop | Excel Programming | |||
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them | Excel Programming | |||
Need a macro to loop evaluation of many textboxes in a UserForm. | Excel Programming | |||
loop through textboxes only | Excel Programming |