![Listfillrange Named Range Vba](https://k.kakaocdn.net/dn/b33mPn/btqBljiZrAb/g3hpqlYL9L2bBAeBsX6DIK/img.jpg)
Shortcut #6: Referring To A Named VBA Range. As explained above, when referring to a VBA Range that has a name, you replace the address of the range with the relevant name. Therefore, the basic syntax is “Range(“RangeName”)”. When using square brackets, the logic is the same.
Excel Listfillrange
I am trying to use 2 different Listfill Ranges in a combo box depending onwhether a check box is true or false. The code blows up on the last line ofcode ComboBoxDept.ListFillRange = NewFillRange.
![Excel vba populate combobox from table Excel vba populate combobox from table](https://www.contextures.com/images/vba/comboboxlistfill03.png)
Can anyone help me figureout what I'm doing wrong?Dim NewFillRange As RangeIf CheckBoxEntity.Value = True Then Set NewFillRange =Worksheets('Demo').Range('DemoDeptByEntity')If CheckBoxEntity.Value = False Then Set NewFillRange =Worksheets('Demo').Range('DemoDept')ComboBoxDept.ListFillRange = NewFillRange.
![Listfillrange Named Range Vba](https://k.kakaocdn.net/dn/b33mPn/btqBljiZrAb/g3hpqlYL9L2bBAeBsX6DIK/img.jpg)