#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 183
Default Combobox

I have a combobox on a sheet and I want to update its list with non numerical
values organised on another sheet in a row.

THIS WORKS:

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address


BUT THIS DOES NOT WORK

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address
Set myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In myrange
ActiveSheet.OLEObjects("Combobox1").AddItem c.Value
Next
THE ERROR is 435 (object does not support this property method
Combobox1.AddItem c.Value does not work either

Any idea?
I call the sub when I activate the sheet
Any help greatly appreciated
--
caroline
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Combobox

Hi,

Try

Set Myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In Myrange
ActiveSheet.OLEObjects("Combobox1").Object.AddItem c.Value
Next

Mike

"caroline" wrote:

I have a combobox on a sheet and I want to update its list with non numerical
values organised on another sheet in a row.

THIS WORKS:

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address


BUT THIS DOES NOT WORK

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address
Set myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In myrange
ActiveSheet.OLEObjects("Combobox1").AddItem c.Value
Next
THE ERROR is 435 (object does not support this property method
Combobox1.AddItem c.Value does not work either

Any idea?
I call the sub when I activate the sheet
Any help greatly appreciated
--
caroline

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 183
Default Combobox

HI Mike,
Thanks for that, but I now have a "run time error 70 permission denied"
error message, when I run the code
Any idea?
--
caroline


"Mike H" wrote:

Hi,

Try

Set Myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In Myrange
ActiveSheet.OLEObjects("Combobox1").Object.AddItem c.Value
Next

Mike

"caroline" wrote:

I have a combobox on a sheet and I want to update its list with non numerical
values organised on another sheet in a row.

THIS WORKS:

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address


BUT THIS DOES NOT WORK

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address
Set myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In myrange
ActiveSheet.OLEObjects("Combobox1").AddItem c.Value
Next
THE ERROR is 435 (object does not support this property method
Combobox1.AddItem c.Value does not work either

Any idea?
I call the sub when I activate the sheet
Any help greatly appreciated
--
caroline

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Combobox

Caroline,

You are getting this becase the ListfillRange property of the combobox is
set to a range. Put the combobox in design mode by clicking the icon on the
toolbar and right click the combo box and view propertiies. Clear out the
range setting for the listfillRange range. exit design mode and the code I
gave you will work.

Mike

"caroline" wrote:

HI Mike,
Thanks for that, but I now have a "run time error 70 permission denied"
error message, when I run the code
Any idea?
--
caroline


"Mike H" wrote:

Hi,

Try

Set Myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In Myrange
ActiveSheet.OLEObjects("Combobox1").Object.AddItem c.Value
Next

Mike

"caroline" wrote:

I have a combobox on a sheet and I want to update its list with non numerical
values organised on another sheet in a row.

THIS WORKS:

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address


BUT THIS DOES NOT WORK

ActiveSheet.OLEObjects("Combobox1").ListFillRange =
Range("SubRegion1").Address
Set myrange = Sheets("Define Regions").Range("SubRegionsList")
For Each c In myrange
ActiveSheet.OLEObjects("Combobox1").AddItem c.Value
Next
THE ERROR is 435 (object does not support this property method
Combobox1.AddItem c.Value does not work either

Any idea?
I call the sub when I activate the sheet
Any help greatly appreciated
--
caroline

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
Combobox items determined by the selection in another combobox Alerion Excel Programming 2 September 13th 06 01:07 PM
Combobox options based on the input of another combobox afmullane[_5_] Excel Programming 1 May 3rd 06 01:44 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM


All times are GMT +1. The time now is 05:57 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"