Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

VB ListBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joakl - 20 Mar 2006 16:00 GMT
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
Edwin Tam - 20 Mar 2006 15:59 GMT
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
edwintam@vonixx.com
http://www.vonixx.com

> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.