Thread: For Loop Help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
skuzapo skuzapo is offline
external usenet poster
 
Posts: 1
Default For Loop Help


Hi, I'm trying to get my head around how to code a For Loop with changes
in the variable name.

I have 19 rows of data and I need to populate some text boxs on a user
form.
I can do this by using 19 lines of code but I'm sure it can be done
using a loop?

This is what I have now:
Me.txtShipWeight1.Value =
Worksheets("Calculations").Range("ShipWeighting1")
Me.txtShipWeight2.Value =
Worksheets("Calculations").Range("ShipWeighting2")
Me.txtShipWeight3.Value =
Worksheets("Calculations").Range("ShipWeighting3")
....
....
etc.

The only difference in each line is the text box control name and the
named range in the worksheet.

Can this be coded in a loop?
Thanks for any help you can offer.
Cheers


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=516014