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 / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

populate combo with month and year

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paulc - 20 Apr 2007 11:52 GMT
Hi,

I'm using XL 2002.

How do I populate ComboBox1 programtically, with a range of month and years
(using the format mmm-yy) starting with the current month of the current
year, incrementing monthly, year on year for 12 months?

So the combo would contain Apr-07 and end with Apr-08

Any ideas appreciated. Thank you.

Paul.
Greg Maxey - 20 Apr 2007 13:20 GMT
In the userform initialize event use something like:
Private Sub UserForm_Initialize()
Dim i As Long
Me.ComboBox1.AddItem Format(Date, "mmm yy")
For i = 1 To 11
 Me.ComboBox1.AddItem Format(DateAdd("m", i, Date), "mmm yy")
Next i
End Sub

> Hi,
>
[quoted text clipped - 9 lines]
>
> Paul.
Paulc - 20 Apr 2007 13:54 GMT
XL'nt - thank you.

> In the userform initialize event use something like:
> Private Sub UserForm_Initialize()
[quoted text clipped - 18 lines]
> >
> > Paul.
 
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.