Autofill months in cell

P

paradise

I have a combobox in userform containing months like January,

February, March,so on. How do i write a code such that if the user

select a particular month (say January) in the combobox, it will be

written to cell A1, after which the program could autofill the months

from cell A2 downwards, reflecting February, March, and so on.?

Thanks:)
 
V

Vasant Nanavati

(Untested):

Dim i As Integer
For i = 1 to 12
Range("A" & i) = CStr(Format(DateSerial(Year(Date), _
Month(DateValue("1-" & UserForm1.ComboBox1)) + i, 1), "mmmm"))
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top