Thread: VB ListBox
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Edwin Tam[_7_] Edwin Tam[_7_] is offline
external usenet poster
 
Posts: 94
Default VB ListBox

In your userform (double-click the form), paste the following code to
"UserForm_Activate". Assume that your listbox is called "ListBox1".

Private Sub UserForm_Activate()
Dim tmp As Integer
With ListBox1
.Clear
For tmp = 1 To 12
.AddItem Format(DateSerial(2006, tmp, 1), "mmmm")
Next
End With
End Sub

Regards,
Edwin Tam

http://www.vonixx.com


"joakl" wrote:

I've never used user forms as part of a macro. I am trying to create a list
box in a user form but can't figure how to enter the list of months. I have
created the user form and inserted the list box, just can't type the months
in...any answers?

Thanks in advance