ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with setting the ListFillRange in VBA (https://www.excelbanter.com/excel-programming/317380-problem-setting-listfillrange-vba.html)

spacecityguy[_6_]

Problem with setting the ListFillRange in VBA
 

Hi,

As an experiment, I opened a blank sheet and added a combo box usin
the Control Toolbox. I named this combo box cboList. I then add
button and this code to it:

activesheet.shapes("cboList").controlformat.listfi llrange = "A1:A10"

When I ran the code, I got this error:

"Object doesn't support this property or method."

I looked up a few books on VBA for Excel programming as well as Exce
Help but got little help from them. This seems to be a very trivia
matter, and I don't know what else to try. I'll appreciate if anybod
can explain it to me.

Eventually, I would like to be able to read a list of values from th
database (using the add-in provided by the database) and assign a nam
to this list and then use the name for the listfillrange of my comb
box. I don't really need to use a name, but it'll make the rang
available in other parts of my application. I built eveyrthing already
The last hurdle I needed to get through is setting the listfillrang
using code.

Thanks for reading,
spacecitygu

--
spacecitygu
-----------------------------------------------------------------------
spacecityguy's Profile: http://www.excelforum.com/member.php...fo&userid=1106
View this thread: http://www.excelforum.com/showthread.php?threadid=31878


spacecityguy[_7_]

Problem with setting the ListFillRange in VBA
 

Instead of following Excel help to refer to my listfillrange as below:

worksheets(i).shapes(i).controlformat.listfillrang e = "R1C1"

which kept giving me the "object not defined" error.

I found out this will work:

worksheets(i).[name of my list box].listfillrange = "R1C1"

Sometimes I just don't understand how the object/class/property work
in VBA for Excel.

spacecitygu

--
spacecitygu
-----------------------------------------------------------------------
spacecityguy's Profile: http://www.excelforum.com/member.php...fo&userid=1106
View this thread: http://www.excelforum.com/showthread.php?threadid=31878


spacecityguy[_8_]

Problem with setting the ListFillRange in VBA
 

I failed to recognize the difference between ActiveX controls and M
Excel Form Controls

--
spacecitygu
-----------------------------------------------------------------------
spacecityguy's Profile: http://www.excelforum.com/member.php...fo&userid=1106
View this thread: http://www.excelforum.com/showthread.php?threadid=31878



All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com