Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Hi,
Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Link the RowSource (if a form) property of the combobox to the range of data
on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Hi Bob
The sourse lines of text are not from a row but just lines of text I have created for the CombeBox. But anyway not sure how to link all this and make it work Thanks "Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
and yes I'm using a user form
"Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Okay, so use
Private Sub Userform_Activate() With Me.ComboBox1 .AddItem "Text1" .AddItem "Text2" '.. etc .ControlSource = Range("D4").Address(external:=True) End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi Bob The sourse lines of text are not from a row but just lines of text I have created for the CombeBox. But anyway not sure how to link all this and make it work Thanks "Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Thanks Bob I got it all working with the OK button Thanks again James "Bob Phillips" wrote in message ... Okay, so use Private Sub Userform_Activate() With Me.ComboBox1 .AddItem "Text1" .AddItem "Text2" '.. etc .ControlSource = Range("D4").Address(external:=True) End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi Bob The sourse lines of text are not from a row but just lines of text I have created for the CombeBox. But anyway not sure how to link all this and make it work Thanks "Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
I am having a combobox on a worksheet. I like to fill it in the
worksheet_open() function. In VBA how do i get these methods? - additem, dataitem, list etc for combobox. I declared a worksheet wb code in thisworkbook -------------------- Option Explicit Public DeptLocRange As Range, AcctRange As Range Public ws As Worksheet Private Sub Workbook_Open() Dim r As Integer Set ws = Me.Worksheets("Expenses") With ws Set DeptLocRange = .Range(.Cells(79, 3), .Cells(86, 6)) Set AcctRange = .Range(.Cells(91, 3), .Cells(92, 16)) r = 2 DeptLocRange.Select ' Worksheets("Expenses").cmbLocation.AddItem ("<select Loc") ' While Not IsNull(DeptLocRange(r, 1)) ' .cmbLocation.AddItem = DeptLocRange(r, 1) ' Wend ' .cmbLocation.ListIndex = 0 ' .cmbDepartment.ListIndex = 0 End With Worksheets("Expenses").cmbLocation.ListIndex = 0 Worksheets("Expenses").cmbDepartment.ListIndex = 0 End Sub -------------------- commented lines are not working. wb.cmbLocation.listindex won't work. but the last two lines works. Any help is greatly appreciated. Thanks MVMurthy ******************** "Bob Phillips" wrote: Okay, so use Private Sub Userform_Activate() With Me.ComboBox1 .AddItem "Text1" .AddItem "Text2" '.. etc .ControlSource = Range("D4").Address(external:=True) End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi Bob The sourse lines of text are not from a row but just lines of text I have created for the CombeBox. But anyway not sure how to link all this and make it work Thanks "Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox
Are you sure it's the commented lines that's causing the trouble.
If you get rid of deptLocRange.select, will it work? And if you change isNull() to isEmpty() does that help? If neither of these fixes your problem, maybe you can post some more details of what happens when you step through the code. MVM wrote: I am having a combobox on a worksheet. I like to fill it in the worksheet_open() function. In VBA how do i get these methods? - additem, dataitem, list etc for combobox. I declared a worksheet wb code in thisworkbook -------------------- Option Explicit Public DeptLocRange As Range, AcctRange As Range Public ws As Worksheet Private Sub Workbook_Open() Dim r As Integer Set ws = Me.Worksheets("Expenses") With ws Set DeptLocRange = .Range(.Cells(79, 3), .Cells(86, 6)) Set AcctRange = .Range(.Cells(91, 3), .Cells(92, 16)) r = 2 DeptLocRange.Select ' Worksheets("Expenses").cmbLocation.AddItem ("<select Loc") ' While Not IsNull(DeptLocRange(r, 1)) ' .cmbLocation.AddItem = DeptLocRange(r, 1) ' Wend ' .cmbLocation.ListIndex = 0 ' .cmbDepartment.ListIndex = 0 End With Worksheets("Expenses").cmbLocation.ListIndex = 0 Worksheets("Expenses").cmbDepartment.ListIndex = 0 End Sub -------------------- commented lines are not working. wb.cmbLocation.listindex won't work. but the last two lines works. Any help is greatly appreciated. Thanks MVMurthy ******************** "Bob Phillips" wrote: Okay, so use Private Sub Userform_Activate() With Me.ComboBox1 .AddItem "Text1" .AddItem "Text2" '.. etc .ControlSource = Range("D4").Address(external:=True) End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi Bob The sourse lines of text are not from a row but just lines of text I have created for the CombeBox. But anyway not sure how to link all this and make it work Thanks "Bob Phillips" wrote in message ... Link the RowSource (if a form) property of the combobox to the range of data on the worksheet, and set the Controlsource property to D4 to get the value stored there. -- HTH RP (remove nothere from the email address if mailing direct) "James Montgomery" wrote in message ... Hi, Can someone help me with populating a ComboBox with say Text Line 1 Text Line 2 Text Line 3 Than after the user chooses one say 'Text Line 2' have it show his pick in the Combobox. User would than have to click an 'OK' button to dislplay it in say in ("D4"). I would want the ability to able to add more 'Text Lines' to the code myself. If this is asking to much could someone direct me to a site that might have such a routine or to someone I could pay for his or her services. Thanks, James -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox | Excel Programming | |||
Populating combobox from another combobox | Excel Programming | |||
ComboBox | Excel Programming | |||
ComboBox | Excel Programming |