Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default change controlsource for textbox depending on combobox selection

Hi, I have a userform with 3 cascading comboboxes, and a textbox. I need the
controlsource of the textbox to change depending upon the selection in
combobox3. I am looking for the code. I have in mind something like: If
combobox3.value = "wages" then textbox1.controlsource = sheet3, A1 etc. but
cant get it to work, also tried
If TextBox1.Value = w Then TextBox1.ControlSource =
Worksheets("main").Range("A1")
If TextBox1.Value = x Then TextBox1.ControlSource =
Worksheets("main").Range("b1")
Can anyone help please?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default change controlsource for textbox depending on combobox selection

If ComboBox1.Value = "wages" Then
TextBox1.ControlSource = "Sheet3!A1"
End If

You enter it the same way you would enter it in the Properties dialog box
except enclose it in double quotes in the code.

--
Regards,

OssieMac


"Maverikk" wrote:

Hi, I have a userform with 3 cascading comboboxes, and a textbox. I need the
controlsource of the textbox to change depending upon the selection in
combobox3. I am looking for the code. I have in mind something like: If
combobox3.value = "wages" then textbox1.controlsource = sheet3, A1 etc. but
cant get it to work, also tried
If TextBox1.Value = w Then TextBox1.ControlSource =
Worksheets("main").Range("A1")
If TextBox1.Value = x Then TextBox1.ControlSource =
Worksheets("main").Range("b1")
Can anyone help please?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default change controlsource for textbox depending on combobox selecti

Thanks Ossie Mac - really owe you one! Perfect.

"OssieMac" wrote:

If ComboBox1.Value = "wages" Then
TextBox1.ControlSource = "Sheet3!A1"
End If

You enter it the same way you would enter it in the Properties dialog box
except enclose it in double quotes in the code.

--
Regards,

OssieMac


"Maverikk" wrote:

Hi, I have a userform with 3 cascading comboboxes, and a textbox. I need the
controlsource of the textbox to change depending upon the selection in
combobox3. I am looking for the code. I have in mind something like: If
combobox3.value = "wages" then textbox1.controlsource = sheet3, A1 etc. but
cant get it to work, also tried
If TextBox1.Value = w Then TextBox1.ControlSource =
Worksheets("main").Range("A1")
If TextBox1.Value = x Then TextBox1.ControlSource =
Worksheets("main").Range("b1")
Can anyone help please?


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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
ReadOnly TextBox from ControlSource [email protected] Excel Programming 0 June 6th 08 12:45 AM
TextBox ControlSource marwan[_2_] Excel Programming 0 September 19th 05 06:18 PM
A Simply ComboBox Selection returns value to TextBox thom hoyle Excel Programming 2 June 24th 05 12:42 AM
Userform: Textbox changing with selection in combobox (list) NorTor[_3_] Excel Programming 3 June 8th 04 10:19 PM


All times are GMT +1. The time now is 12:17 AM.

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"