Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default concatinate a textbox name

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,

  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default concatinate a textbox name

Dave,
Thank you so much, this worked perfectly!

"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,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatinate name and date Don Excel Discussion (Misc queries) 4 July 9th 08 10:35 PM
Concatinate Formatting PFLY Excel Discussion (Misc queries) 4 March 25th 08 09:36 PM
concatinate data Rhonda Excel Worksheet Functions 4 January 20th 06 05:51 PM
concatinate and vlookup darsg Excel Programming 7 October 27th 05 09:53 PM
Concatinate a filename CLR Excel Discussion (Misc queries) 28 August 1st 05 11:45 PM


All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"