View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pranav Vaidya Pranav Vaidya is offline
external usenet poster
 
Posts: 180
Default First day of month

Try the below code

Dim mDate As Date
Dim mStr
mDate = DateAdd("m", 1, Range("L3").Value)
mStr = "01-" & Format(mDate, "mmm-yy")
Range("M3").Value = Format(mStr, "dd-mmm-yy")

Hope this helps!!
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Dianne Groom" wrote:

A cell in an Excel workbook contains a date. I want to write macro code to
generate, in another cell, the date of the first day of the next month.



I was going to use the Excel EOMONTH function, but Excel 2002, does not seem
to support the function. I can generate the date using the DATE function,
and I tried using Application.WorksheetFunction in my macro, but it did not
work with the Excel DATE function.



Any suggestions for macro code that will generate the first day of the next
month would be appreciated.