ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill months in cell (https://www.excelbanter.com/excel-programming/283407-autofill-months-cell.html)

paradise

Autofill months in cell
 
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:)

Vasant Nanavati

Autofill months in cell
 
(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

--

Vasant


"paradise" wrote in message
om...
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:)





All times are GMT +1. The time now is 11:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com