WhiteD3
24th October 2008, 02:42 PM
Guru needed:)
I've got an Excel form with 10 textboxes named tbBox1, tbBox2, etc.
In my VBA code I want to run a loop that looks through a sheet and when it finds a value, populate that value into tbBox1, keep looking and when it finds then next value populate tbBox2, etc, etc.
What I'm after is a way to dynamically change the textbox I'm referring to instead of individually naming them.
ie
For i= 1 to 10
MyName = "tbBox" & i
MyName.Value = Worksheets("Stock List").Cells(j, Stock_Column).Value
Of course, this doesn't work. Any ideas please?
I've got an Excel form with 10 textboxes named tbBox1, tbBox2, etc.
In my VBA code I want to run a loop that looks through a sheet and when it finds a value, populate that value into tbBox1, keep looking and when it finds then next value populate tbBox2, etc, etc.
What I'm after is a way to dynamically change the textbox I'm referring to instead of individually naming them.
ie
For i= 1 to 10
MyName = "tbBox" & i
MyName.Value = Worksheets("Stock List").Cells(j, Stock_Column).Value
Of course, this doesn't work. Any ideas please?