Hi everyone, i have a question to ask
i need to set to be previous month of the current date in cell D16 on startup of the excel.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
2. For year in cell D15, if current month is Jan, then use previous year, else will use current year.
2. For year in cell D15, if current month is Jan, then use previous year, else will use current year.
How do i code that out?
i have the following codes out now..
i have the following codes out now..
Sub ThisDate()
'display current month. eg Sep. For September, change to mmmm.
mth = UCase(Format(Date, "mmm"))
'Edit the position for the date to be displayed in the .Range("_") field.
Sheets("List").Range("D16").Value = mth
' display current year. eg FY2011.
yr = UCase(Format(Date, "yyyy"))
'Edit the position for the date to be displayed in the .Range("_") field.
Sheets("List").Range("D15").Value = "FY" + yr
End Sub
'display current month. eg Sep. For September, change to mmmm.
mth = UCase(Format(Date, "mmm"))
'Edit the position for the date to be displayed in the .Range("_") field.
Sheets("List").Range("D16").Value = mth
' display current year. eg FY2011.
yr = UCase(Format(Date, "yyyy"))
'Edit the position for the date to be displayed in the .Range("_") field.
Sheets("List").Range("D15").Value = "FY" + yr
End Sub
Thanks