Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA userform textboxes

Status
Not open for further replies.

clifftech

ISP
Nov 9, 2001
111
US
There has to be an easier way...

I have 60 userform text boxes (txtBox1, txtBox2, etc.) that I need to insert values from the spreadsheet. What I am using now is:

frmPax.txtBox1.Value = Range("A1")
frmPax.txtBox2.Value = Range("A2")
...
...

Instead of using 60 lines of code I would like to use a loop that simply changes the last digit of the textbox via the loop counter and also offsetting the cell Range down by one cell for each loop.

When I try

frmPax.txtBox(i). Value

where i is the counter number I get an error message saying method or date member not found.

Is there an easy way to do this?

Thanks in advance for any help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top