Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings,
I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Update:
I changed the style property back to "0 - fmStyleDropDownCombo". The code went a little further before it was stopped by this error message: Run-time error '381': Could not get the List property. Invalid property array index. With this code: ComboBox1.List(ComboBox1.ListIndex, 2) I forgot to mention earlier, the named range that is the 'RowSource' for ComboBox1 is 27 rows high and 105 columns wide. It is the 3rd column that is displayed in ComboBox1. It is this same third column (in the 1st empty row) that I am trying to add to from TextBox1. Anyone have any ideas as to how to eliminate this error? Any help would be appreciated -Minitman On Tue, 02 Sep 2008 07:55:26 -0500, Minitman wrote: Greetings, I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you're using .rowsource, then you won't be able to mess with the list.
You could use .additem, but then you're limited to 10 columns in your combobox. Do you need all 105 columns showing up in your combobox? If you do, then you may want to just plop the values of the textbox into the rowsource range??? Minitman wrote: Update: I changed the style property back to "0 - fmStyleDropDownCombo". The code went a little further before it was stopped by this error message: Run-time error '381': Could not get the List property. Invalid property array index. With this code: ComboBox1.List(ComboBox1.ListIndex, 2) I forgot to mention earlier, the named range that is the 'RowSource' for ComboBox1 is 27 rows high and 105 columns wide. It is the 3rd column that is displayed in ComboBox1. It is this same third column (in the 1st empty row) that I am trying to add to from TextBox1. Anyone have any ideas as to how to eliminate this error? Any help would be appreciated -Minitman On Tue, 02 Sep 2008 07:55:26 -0500, Minitman wrote: Greetings, I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Dave,
Thanks for the reply. Here is the code I use to load ComboBox1 at the UserForm Initialization: Set rListInput = ws1_2.Range("rInput" & iTD) With ComboBox1 .RowSource = "'Input'!" & rListInput.Address .ColumnCount = rListInput.Columns.Count .ListIndex = 0 End With rInput is a series of named ranges. iTD has a range of 1 to 31. These ranges are 27 rows high and 105 columns wide. I chose this method for ease of loading and modifying 105 TextBoxes on a UserForm (code available upon request). Do you know of a better way to load ComboBox1 and make it dynamic to change as needed? -Minitman On Tue, 02 Sep 2008 10:10:53 -0500, Dave Peterson wrote: If you're using .rowsource, then you won't be able to mess with the list. You could use .additem, but then you're limited to 10 columns in your combobox. Do you need all 105 columns showing up in your combobox? If you do, then you may want to just plop the values of the textbox into the rowsource range??? Minitman wrote: Update: I changed the style property back to "0 - fmStyleDropDownCombo". The code went a little further before it was stopped by this error message: Run-time error '381': Could not get the List property. Invalid property array index. With this code: ComboBox1.List(ComboBox1.ListIndex, 2) I forgot to mention earlier, the named range that is the 'RowSource' for ComboBox1 is 27 rows high and 105 columns wide. It is the 3rd column that is displayed in ComboBox1. It is this same third column (in the 1st empty row) that I am trying to add to from TextBox1. Anyone have any ideas as to how to eliminate this error? Any help would be appreciated -Minitman On Tue, 02 Sep 2008 07:55:26 -0500, Minitman wrote: Greetings, I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not if you need all 105 columns.
Minitman wrote: Hey Dave, Thanks for the reply. Here is the code I use to load ComboBox1 at the UserForm Initialization: Set rListInput = ws1_2.Range("rInput" & iTD) With ComboBox1 .RowSource = "'Input'!" & rListInput.Address .ColumnCount = rListInput.Columns.Count .ListIndex = 0 End With rInput is a series of named ranges. iTD has a range of 1 to 31. These ranges are 27 rows high and 105 columns wide. I chose this method for ease of loading and modifying 105 TextBoxes on a UserForm (code available upon request). Do you know of a better way to load ComboBox1 and make it dynamic to change as needed? -Minitman On Tue, 02 Sep 2008 10:10:53 -0500, Dave Peterson wrote: If you're using .rowsource, then you won't be able to mess with the list. You could use .additem, but then you're limited to 10 columns in your combobox. Do you need all 105 columns showing up in your combobox? If you do, then you may want to just plop the values of the textbox into the rowsource range??? Minitman wrote: Update: I changed the style property back to "0 - fmStyleDropDownCombo". The code went a little further before it was stopped by this error message: Run-time error '381': Could not get the List property. Invalid property array index. With this code: ComboBox1.List(ComboBox1.ListIndex, 2) I forgot to mention earlier, the named range that is the 'RowSource' for ComboBox1 is 27 rows high and 105 columns wide. It is the 3rd column that is displayed in ComboBox1. It is this same third column (in the 1st empty row) that I am trying to add to from TextBox1. Anyone have any ideas as to how to eliminate this error? Any help would be appreciated -Minitman On Tue, 02 Sep 2008 07:55:26 -0500, Minitman wrote: Greetings, I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Dave,
I was afraid of that. Thanks for the input. -Minitman On Tue, 02 Sep 2008 13:07:56 -0500, Dave Peterson wrote: Not if you need all 105 columns. Minitman wrote: Hey Dave, Thanks for the reply. Here is the code I use to load ComboBox1 at the UserForm Initialization: Set rListInput = ws1_2.Range("rInput" & iTD) With ComboBox1 .RowSource = "'Input'!" & rListInput.Address .ColumnCount = rListInput.Columns.Count .ListIndex = 0 End With rInput is a series of named ranges. iTD has a range of 1 to 31. These ranges are 27 rows high and 105 columns wide. I chose this method for ease of loading and modifying 105 TextBoxes on a UserForm (code available upon request). Do you know of a better way to load ComboBox1 and make it dynamic to change as needed? -Minitman On Tue, 02 Sep 2008 10:10:53 -0500, Dave Peterson wrote: If you're using .rowsource, then you won't be able to mess with the list. You could use .additem, but then you're limited to 10 columns in your combobox. Do you need all 105 columns showing up in your combobox? If you do, then you may want to just plop the values of the textbox into the rowsource range??? Minitman wrote: Update: I changed the style property back to "0 - fmStyleDropDownCombo". The code went a little further before it was stopped by this error message: Run-time error '381': Could not get the List property. Invalid property array index. With this code: ComboBox1.List(ComboBox1.ListIndex, 2) I forgot to mention earlier, the named range that is the 'RowSource' for ComboBox1 is 27 rows high and 105 columns wide. It is the 3rd column that is displayed in ComboBox1. It is this same third column (in the 1st empty row) that I am trying to add to from TextBox1. Anyone have any ideas as to how to eliminate this error? Any help would be appreciated -Minitman On Tue, 02 Sep 2008 07:55:26 -0500, Minitman wrote: Greetings, I have a ComboBox that is loaded when the UserForm is Initialized. But sometimes I need to add a name to the bottom of the ComboBox list from a TextBox. I am getting this error message: Runtime error '70': Could not set the List property. Permission denied. Here is the code: ComboBox1.List(ComboBox1.ListIndex, 2) = TextBox1.Value I need the value of TextBox1 inserted into the 3rd column of the ComboBox1 row that is currently chosen. Is this possible? If so, how do I do it? Any help would be appreciated. -Minitman |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Minitman
if you are using Rowsource you will have to pass the data from your textbox to your worksheet which will in turn update your combobox, something like the code below will do what you want i think. it will change the value in the third column of the selected row in the combobox. With Sheets("Sheet1") .Cells(ComboBox1.ListIndex + 1, 3).Value = TextBox1.Value End With hope this helps Steve |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Steve,
Thanks for the reply. I tried your code. It works somewhat but It has two problems. It won't continue (it freezes) and it only affects the 1st named range regardless of what day the user is working with. I was able adjust the position of the entry, accept for which day it showed up in (it only shoes up in day 1).. The name of the chosen named range is Range("rInput" & iTD) Any ideas as to how to get this to work? Again thanks for the help. -Minitman On Tue, 2 Sep 2008 08:24:11 -0700 (PDT), Incidental wrote: Hi Minitman if you are using Rowsource you will have to pass the data from your textbox to your worksheet which will in turn update your combobox, something like the code below will do what you want i think. it will change the value in the third column of the selected row in the combobox. With Sheets("Sheet1") .Cells(ComboBox1.ListIndex + 1, 3).Value = TextBox1.Value End With hope this helps Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ComboBox Will Not Advance To next Item in list | Excel Programming | |||
Combobox item selection+pop up list | Excel Programming | |||
Combobox - can't get click event to run for first item in the list | Excel Programming | |||
combobox list item with superscript | Excel Programming | |||
Automated Delete Item from ComboBox List | Excel Programming |