Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Setting ListFillRange through VBA

I have a combo box called ComboBox1 on a worksheet. I want to populate
its values in VBA code.

Let's say my list of values is in J2:J12.



I then issue this command: ComboBox1.ListFillRange = "J2:J12", I get
a "Run-time error '424'; Object required" message


If I change this to: Set Worksheets(1).ComboBox1.ListFillRange =
"J2:J12", I get "Run-time error '438'; Object doesn't support this
property or method."



Tried several other combinations, but nothing works yet.

Can anyone help? Thanks.



Dennis Hancy
Eaton Corporation
Cleveland, OH

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default Setting ListFillRange through VBA

If you are running code from the same WS that contains ComboBox1 you first
code will work.
If not, your second code will work, but without the "Set", as you are not
'setting' an object variable.

NickHK

"
egroups.com...
I have a combo box called ComboBox1 on a worksheet. I want to populate
its values in VBA code.

Let's say my list of values is in J2:J12.



I then issue this command: ComboBox1.ListFillRange = "J2:J12", I get
a "Run-time error '424'; Object required" message


If I change this to: Set Worksheets(1).ComboBox1.ListFillRange =
"J2:J12", I get "Run-time error '438'; Object doesn't support this
property or method."



Tried several other combinations, but nothing works yet.

Can anyone help? Thanks.



Dennis Hancy
Eaton Corporation
Cleveland, OH



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Setting ListFillRange through VBA

Worksheets(1).ComboBox1.ListFillRange ="J2:J12"

but I would include the sheet name as well

With Worksheets(1)
.ComboBox1.ListFillRange = .Name & "!J2:J12"
End with

if it is on Worksheets(1)

--
Regards,
Tom Ogilvy


" wrote:

I have a combo box called ComboBox1 on a worksheet. I want to populate
its values in VBA code.

Let's say my list of values is in J2:J12.



I then issue this command: ComboBox1.ListFillRange = "J2:J12", I get
a "Run-time error '424'; Object required" message


If I change this to: Set Worksheets(1).ComboBox1.ListFillRange =
"J2:J12", I get "Run-time error '438'; Object doesn't support this
property or method."



Tried several other combinations, but nothing works yet.

Can anyone help? Thanks.



Dennis Hancy
Eaton Corporation
Cleveland, OH


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Setting ListFillRange through VBA

Thanks Tom..

Looks like I forgot the ".name" piece. Once I put that in, it worked
great.



Dennis


Tom Ogilvy wrote:
Worksheets(1).ComboBox1.ListFillRange ="J2:J12"

but I would include the sheet name as well

With Worksheets(1)
.ComboBox1.ListFillRange = .Name & "!J2:J12"
End with

if it is on Worksheets(1)

--
Regards,
Tom Ogilvy


" wrote:

I have a combo box called ComboBox1 on a worksheet. I want to populate
its values in VBA code.

Let's say my list of values is in J2:J12.



I then issue this command: ComboBox1.ListFillRange = "J2:J12", I get
a "Run-time error '424'; Object required" message


If I change this to: Set Worksheets(1).ComboBox1.ListFillRange =
"J2:J12", I get "Run-time error '438'; Object doesn't support this
property or method."



Tried several other combinations, but nothing works yet.

Can anyone help? Thanks.



Dennis Hancy
Eaton Corporation
Cleveland, OH



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
ComboBox ListFillRange Stefi Excel Discussion (Misc queries) 14 April 21st 08 12:55 PM
How to Set ListFillRange to Another Sheet Chaplain Doug Excel Programming 3 April 29th 05 01:54 PM
Problem with setting the ListFillRange in VBA spacecityguy[_6_] Excel Programming 2 November 19th 04 10:20 PM
ListFillRange Dave Baranas Excel Programming 0 August 12th 03 05:09 AM
ListFillRange Dave Baranas Excel Programming 1 August 11th 03 11:08 PM


All times are GMT +1. The time now is 09:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"