ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing Listbox on Worksheet (https://www.excelbanter.com/excel-programming/305069-referencing-listbox-worksheet.html)

The Vision Thing

Referencing Listbox on Worksheet
 
I've inserted a listbox called 'listcategory' directly onto a worksheet
called 'test'. I'm trying to programmatically add items to this listbox
using the following code but I get an 'Object Required' error message:

With Worksheets("test")
ListCategory.Clear
ListCategory.additem("wayne")
End With

How do I reference this listbox in Excel VBA?

Thanks,
Wayne C.



Stan Scott

Referencing Listbox on Worksheet
 
Wayne,

Is this exactly the code you're using?? If so, you're missing a period
before each "ListCategory" reference.

Stan Scott
New York City

"The Vision Thing" wrote in message
...
I've inserted a listbox called 'listcategory' directly onto a worksheet
called 'test'. I'm trying to programmatically add items to this listbox
using the following code but I get an 'Object Required' error message:

With Worksheets("test")
ListCategory.Clear
ListCategory.additem("wayne")
End With

How do I reference this listbox in Excel VBA?

Thanks,
Wayne C.






All times are GMT +1. The time now is 10:19 PM.

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