Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello:
How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This would be incorporated into the UserForm initialize
event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's a active x combo box embdded in the sheet, however I tried it and syntax
error comes up, with srcRng = Range("I2:I & lstRw).Address highlighted? "JLGWhiz" wrote: This would be incorporated into the UserForm initialize event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There were a couple of typos in the original code:
Option Explicit Private Sub UserForm_Initialize() Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) Me.ComboBox1.RowSource = srcRng End Sub art wrote: It's a active x combo box embdded in the sheet, however I tried it and syntax error comes up, with srcRng = Range("I2:I & lstRw).Address highlighted? "JLGWhiz" wrote: This would be incorporated into the UserForm initialize event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need it for an activex combo box. it doesn't work for that. How can I make
it work for the activeX combobox as well? "Dave Peterson" wrote: There were a couple of typos in the original code: Option Explicit Private Sub UserForm_Initialize() Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) Me.ComboBox1.RowSource = srcRng End Sub art wrote: It's a active x combo box embdded in the sheet, however I tried it and syntax error comes up, with srcRng = Range("I2:I & lstRw).Address highlighted? "JLGWhiz" wrote: This would be incorporated into the UserForm initialize event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think I got it strieght a little I changed it to listfillrange. However the
problem is that the column I has a formula, so It goes down. And most importantly, The combo list is long but I don't see and thing in the list. It is empty. Here is the formula that I adjusted: Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Sheets("Customer List").Select Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) ComboBox1.ListFillRange = srcRng "Dave Peterson" wrote: There were a couple of typos in the original code: Option Explicit Private Sub UserForm_Initialize() Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) Me.ComboBox1.RowSource = srcRng End Sub art wrote: It's a active x combo box embdded in the sheet, however I tried it and syntax error comes up, with srcRng = Range("I2:I & lstRw).Address highlighted? "JLGWhiz" wrote: This would be incorporated into the UserForm initialize event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you could drop the code altogether and use a dynamic range name.
Debra Dalgleish explains dynamic range names he http://contextures.com/xlNames01.html#Dynamic art wrote: I think I got it strieght a little I changed it to listfillrange. However the problem is that the column I has a formula, so It goes down. And most importantly, The combo list is long but I don't see and thing in the list. It is empty. Here is the formula that I adjusted: Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Sheets("Customer List").Select Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) ComboBox1.ListFillRange = srcRng "Dave Peterson" wrote: There were a couple of typos in the original code: Option Explicit Private Sub UserForm_Initialize() Dim sh As Worksheet Dim lstRw As Long Dim srcRng As String Set sh = ActiveSheet With sh lstRw = .Cells(.Rows.Count, 9).End(xlUp).Row End With srcRng = Range("I2:I" & lstRw).Address(external:=True) Me.ComboBox1.RowSource = srcRng End Sub art wrote: It's a active x combo box embdded in the sheet, however I tried it and syntax error comes up, with srcRng = Range("I2:I & lstRw).Address highlighted? "JLGWhiz" wrote: This would be incorporated into the UserForm initialize event code. Dim sh As Worksheet, lstRw As Long sh = ActiveSheet lstRw = sh.Cells(Rows.Coount, 9).End(xlUp).Row srcRng = Range("I2:I & lstRw).Address Me.ComboBox1.ListFillRange = srcRng "art" wrote: Hello: How can I set a combo list to a range in a certain sheet that the length of the range keeps changing and new names are added to the list? For e.g. the list starts off from I2:I10, however I keep adding to the list and I want the combobox to add the newer ones to the list as well. I started using ComboBox1.ListFillRange = MyRange, which is I2:last cell in this column? Any help? Thanks. Art -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get range in list from combobox value | Excel Programming | |||
ComboBox list reliant on the entry from a different ComboBox | Excel Programming | |||
Dynamically assign ComboBox.List from named range areas | Excel Programming | |||
ComboBox List Fill Range | Excel Programming | |||
missing items in sheet's activex list/combobox after resizing range | Excel Programming |