View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Using a DO loop to add values into a textbox

If you name them nicely, maybe...

col = 0
Do
co1 = co1 + 1
userform1.controls("textbox" & co1) = varray(co1)
if co1 = 100 then exit do
Loop

You really have 100 textboxes on your form?


Ian B wrote:

I have a series of textboxes in a form and want to enter the values from an
array into each of the textboxes.

Is there any way to do this using a DO loop rather than having to write out
each textbox one by one

something like

co1 = 0
Do
co1 = co1 + 1
userform1.textbox(co1) = varray(co1)
if co1 = 100 then exit do
Loop

rather than

userform1.textbox1 = varray(1)
userform2.textbox2 = varray(2)
etc
etc

Ian B


--

Dave Peterson