View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Userform Controls

Thanks Bob, that is part of the problem solved. My challenge is with a
subset of controls of the same type I wish to act on.

I have a set of code linked to controls named c1 to cn, an event from anyone
of these acts on another control named x1, x2 to xn etc.

Whichever control c1 to cn is pressed the same code for x1 to xn needs to
run. Somehow I need to pass the number of the cn control to the code to act
on the xn control.

Any thoughts?


--
Cheers
Nigel



"Bob Phillips" wrote in message
...
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