Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Need One combo box row source to change based on the value of anot

I can't seem to get it to work. I keep getting "object doesn't support this
property or method, even though I see the property in the list of options.

I have ProdCatValue defined as a public string variable, and I call the
procedure from the first dropdown box.


Here is the code:

Public Sub FilterProductNames()
Select Case ProdCatValue

Case "A"
Sheets("Form")!cboProductName.RowSource = "Reference!G4:G13"
Case "B"
Sheets("Form")!cboProductName.RowSource = "Reference!I4:I16"
Case "C"
Sheets("Form")!cboProductName.RowSource = "Reference!K4:K9"
Case "D"
Sheets("Form")!cboProductName.RowSource = "Reference!C19:c23"
Case "E"
Sheets("Form")!cboProductName.RowSource = "Reference!E19:E73"

Case Else

End Select

End Sub

I have also tried it with listfillrange instead of rowsource, but neither
works.

I have also tried it directly in the on change event for the first combo,
with everything enclosed. (I moved it to a public sub because I thought at
first that the data type for the listfillrange / rowsource property was range
instead of string, and the range was on another worksheet.)

What am I doing wrong?

Katie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Need One combo box row source to change based on the value of anot

Hi Katie

Try using this code
Sheets("Form").cboProductName.ListFillRange = "Reference!A1:A10"

I've never seen the bang notation (!) used to reference controls in Excel,
although I know it is used in Access. Doesn't seem to work.

Also, I think the controls react to which container their in and although
you can use row source when the combo box is on a User Form, it doesn't seem
to be available on spreadsheets.

HTH

Barry


"Katie" wrote:

I can't seem to get it to work. I keep getting "object doesn't support this
property or method, even though I see the property in the list of options.

I have ProdCatValue defined as a public string variable, and I call the
procedure from the first dropdown box.


Here is the code:

Public Sub FilterProductNames()
Select Case ProdCatValue

Case "A"
Sheets("Form")!cboProductName.RowSource = "Reference!G4:G13"
Case "B"
Sheets("Form")!cboProductName.RowSource = "Reference!I4:I16"
Case "C"
Sheets("Form")!cboProductName.RowSource = "Reference!K4:K9"
Case "D"
Sheets("Form")!cboProductName.RowSource = "Reference!C19:c23"
Case "E"
Sheets("Form")!cboProductName.RowSource = "Reference!E19:E73"

Case Else

End Select

End Sub

I have also tried it with listfillrange instead of rowsource, but neither
works.

I have also tried it directly in the on change event for the first combo,
with everything enclosed. (I moved it to a public sub because I thought at
first that the data type for the listfillrange / rowsource property was range
instead of string, and the range was on another worksheet.)

What am I doing wrong?

Katie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Need One combo box row source to change based on the value of

Thanks! That was exactly the problem. I had tried the . (dot) a bit
earlier, but I think at that point I had another thing wrong with my code...
Now everything works exactly as intented.

I really appreciate what a knowledgeable group gives their time to answer
questions here!

It is so quick that I always get my answer within a few days, and the few
times I've known an answer, by the time I went to post it, someone else
already had!

Thanks again.

Katie

"Barry" wrote:

Hi Katie

Try using this code
Sheets("Form").cboProductName.ListFillRange = "Reference!A1:A10"

I've never seen the bang notation (!) used to reference controls in Excel,
although I know it is used in Access. Doesn't seem to work.

Also, I think the controls react to which container their in and although
you can use row source when the combo box is on a User Form, it doesn't seem
to be available on spreadsheets.

HTH

Barry


"Katie" wrote:

I can't seem to get it to work. I keep getting "object doesn't support this
property or method, even though I see the property in the list of options.

I have ProdCatValue defined as a public string variable, and I call the
procedure from the first dropdown box.


Here is the code:

Public Sub FilterProductNames()
Select Case ProdCatValue

Case "A"
Sheets("Form")!cboProductName.RowSource = "Reference!G4:G13"
Case "B"
Sheets("Form")!cboProductName.RowSource = "Reference!I4:I16"
Case "C"
Sheets("Form")!cboProductName.RowSource = "Reference!K4:K9"
Case "D"
Sheets("Form")!cboProductName.RowSource = "Reference!C19:c23"
Case "E"
Sheets("Form")!cboProductName.RowSource = "Reference!E19:E73"

Case Else

End Select

End Sub

I have also tried it with listfillrange instead of rowsource, but neither
works.

I have also tried it directly in the on change event for the first combo,
with everything enclosed. (I moved it to a public sub because I thought at
first that the data type for the listfillrange / rowsource property was range
instead of string, and the range was on another worksheet.)

What am I doing wrong?

Katie

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
Formula to enter data of one cell based on greatest amount of anot classroomlaw Excel Discussion (Misc queries) 1 January 13th 10 01:23 AM
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
Chart changing based on change in data source (number of rows/colu Bal Ram Bhui, Jakarta Charts and Charting in Excel 1 November 16th 08 06:02 AM
Change Pie Chart segment color based on value in source data Doug Charts and Charting in Excel 2 March 2nd 08 04:12 PM
assigning values to one cell which will change the formula in anot Darren Excel Worksheet Functions 1 July 26th 07 10:06 AM


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