Thread: Empty listbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Empty listbox

Derek,

What do you mean by close the sheet? Do you mean you close the workbook
completely? If so, the listbox will not have those values as it will be
re-initialised upon opening the workbook. What you would need to do is put
that code into the Workbook_Open event, so that it is automatically loaded
each time. Either that, or put the values in a worksheet range, and set the
RowSource property to point at that range in the control design.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Derek Gadd" wrote in message
om...
I have a listbox on my worksheet and have added some items to it
using:

Sub temp()
With Sheets("Month").ListBox1
.AddItem ("Yesterday")
.AddItem ("Today")
.AddItem ("Tomorrow")
End With
End Sub

That works fine but when I close the sheet and open it again the
entries disappear. I can briefly see them and then the list is empty.
I have removed all ThisWorkbook code and I disable macros when the
spreadsheet opens. But the entries still disappear. What's going on?

TIA,
Derek