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 concatinate a textbox name

You can name the textbox by changing the (name) property while you're designing
the userform.

Inside the VBE
hit ctrl-r (to see the properties window)
Show the userform
select the textbox
change that (name) property to something you like.

Then you can use:
me.controls("myspecialnamehere").text = "sometext here"
or with your variables:
me.controls(Txb).text = "sometext here"



Dennis wrote:

Help,
How can I assign a value to a textbox on a userform without looping through
all the textboxes. Is it possible to assign the name of the textbox to a
string and use that string to immediately assign a value to the textbox with
that name?

Example:
dim sMo as string
dim sCapExp as string
dim sTxb as string

sMo="Jun"
sCapExp="Cap"
sTxb="txb" & sMO & sCapExp

Is there something like the Sheets object where you can place the name in
parenthesis, i.e. sheets("Summary"). can you do, Textbox(sTxb).Value = "it
works"?

Please let me know,


--

Dave Peterson