Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default combobox.ListFillRangeTrouble in VBA

I am trying to use 2 different Listfill Ranges in a combo box depending on
whether a check box is true or false. The code blows up on the last line of
code ComboBoxDept.ListFillRange = NewFillRange. Can anyone help me figure
out what I'm doing wrong?


Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then Set NewFillRange =
Worksheets("Demo").Range("DemoDeptByEntity")
If CheckBoxEntity.Value = False Then Set NewFillRange =
Worksheets("Demo").Range("DemoDept")
ComboBoxDept.ListFillRange = NewFillRange
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default combobox.ListFillRangeTrouble in VBA


Try these changes

Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then
Set NewFillRange = Worksheets("Demo").Range("DemoDeptByEntity")
Else
Set NewFillRange = Worksheets("Demo").Range("DemoDept")
end if
ComboBoxDept.ListFillRange = NewFillRange


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=150356

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default combobox.ListFillRangeTrouble in VBA

Try it this way:

Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then
Set NewFillRange = Worksheets("Demo").Range("DemoDeptByEntity")
Else
Set NewFillRange = Worksheets("Demo").Range("DemoDept")
End If
ComboBoxDept.ListFillRange = NewFillRange





"DogLover" wrote in message
...
I am trying to use 2 different Listfill Ranges in a combo box depending on
whether a check box is true or false. The code blows up on the last line
of
code ComboBoxDept.ListFillRange = NewFillRange. Can anyone help me figure
out what I'm doing wrong?


Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then Set NewFillRange =
Worksheets("Demo").Range("DemoDeptByEntity")
If CheckBoxEntity.Value = False Then Set NewFillRange =
Worksheets("Demo").Range("DemoDept")
ComboBoxDept.ListFillRange = NewFillRange



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default combobox.ListFillRangeTrouble in VBA

hi
not sure but excel may think you are trying to assign the values of your
named ranges to the listfillrange. you may be getting a type mismatch error.
guessing.
try this......

ComboBoxDept.ListFillRange = NewFillRange.Address

regards
FSt1

"DogLover" wrote:

I am trying to use 2 different Listfill Ranges in a combo box depending on
whether a check box is true or false. The code blows up on the last line of
code ComboBoxDept.ListFillRange = NewFillRange. Can anyone help me figure
out what I'm doing wrong?


Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then Set NewFillRange =
Worksheets("Demo").Range("DemoDeptByEntity")
If CheckBoxEntity.Value = False Then Set NewFillRange =
Worksheets("Demo").Range("DemoDept")
ComboBoxDept.ListFillRange = NewFillRange

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default combobox.ListFillRangeTrouble in VBA

I bet that checkboxentity is set to be checked or unchecked. (You're not using
triplestate = true).

Dim NewFillRange As Range
If me.CheckBoxEntity.Value = True Then
Set NewFillRange = Worksheets("Demo").Range("DemoDeptByEntity")
else 'it has to be false
Set NewFillRange = Worksheets("Demo").Range("DemoDept")
end if
me.ComboBoxDept.ListFillRange = NewFillRange.address(external:=true)





DogLover wrote:

I am trying to use 2 different Listfill Ranges in a combo box depending on
whether a check box is true or false. The code blows up on the last line of
code ComboBoxDept.ListFillRange = NewFillRange. Can anyone help me figure
out what I'm doing wrong?

Dim NewFillRange As Range
If CheckBoxEntity.Value = True Then Set NewFillRange =
Worksheets("Demo").Range("DemoDeptByEntity")
If CheckBoxEntity.Value = False Then Set NewFillRange =
Worksheets("Demo").Range("DemoDept")
ComboBoxDept.ListFillRange = NewFillRange


--

Dave Peterson
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 08:32 AM.

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"