View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Userform Controls

Nigel,

As long as you have a structured naming convention, you could use code like
this that gets the value from each textbox on the form

Dim ctl As Control

For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
MsgBox ctl.Text
End If
Next ctl

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi All
I have a set of controls on a userform, named x1, x2, x3 ........... xn

etc

Is there a way of setting these controls in a loop eg

for i = 1 to n
set control x of i to something
next i

I am not sure how to point to a named control by constructing a string for
the name? Help!

--
Cheers
Nigel