-
Solved: Indirect reference for form controls
Newbie question:
I have a form with six rows of textboxes used to enter the results of a race.
Each row has text boxes named 'Lane1name', 'Lane1Position' . . .
I want to process this data in loops so need to refer to the control values indirectly. Something like:
For Lane = 1 to 6
controlname = "Lane" + format(Lane,"#") + "name"
currentlanename = controlname.value
.
.
Next Lane
Anyone got the magic answer?
Thanks in advance.
-
[vba]
For Lane = 1 to 6
currentlanename = Me.Controls("Lane" & i & "name".Text
.
.
Next Lane
[/vba]
-
Thanks. Saved me hours of browsing the help files.
Much Appreciated.
-
Hi Subwayman,
Welcome to VBAX.
If your question is solved, you can mark it so using the thread tools dropdown.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules