-
Solved: A Simple(?) ComboBox Query
I've been pulling my hair out since lunch with what I'm sure is a simple problem.
I've got a ComboBox on a user form. When the form initialises I want it to be populated with the current date in the format "Mon-YY" along with the following 11 months (ie: 12 months in total).
I'm sure I've done this before but can't for the life of me remember how I did.
Can one of you save my sanity?
Martin
-
Knowledge Base Approver
The King of Overkill!
VBAX Master
Hi Martin,
Sure, but who needs sanity? [vba]Private Sub UserForm_Initialize()
Dim i As Long
For i = 0 To 11
ComboBox1.AddItem Format(DateSerial(Year(Date), Month(Date) + i, 1), "mmm-yy")
Next
End Sub[/vba]
Matt
-
Matt
Many thanks - that's a drink I owe you.
What little sanity I have left is preserved - and the girls in the office don't have to watch a grown man crying any more!!
Martin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules