Thread
:
Find next Date
View Single Post
#
2
Posted to microsoft.public.excel.programming
Justin Smith
external usenet poster
Posts: 2
Find next Date
Perfect Don, thanks :-)
"Don Guillett" wrote:
One way
Sub next22nd()
x = Day(Date)
'x = 22
MsgBox x
If x < 22 Then
y = DateSerial(Year(Date), Month(Date), 22)
Else
y = DateSerial(Year(Date), Month(Date) + 1, 22)
End If
MsgBox y
End Sub
--
Don Guillett
SalesAid Software
"Justin Smith" wrote in message
...
John Green posted this elegant formula to find the next Friday based on
today's date:
=TODAY()-WEEKDAY(TODAY()+1)+7
I want to do something similar, but in VBA. I want to write a custom
function that will return the next 22nd of the month based on today's
date,
e.g. if today is 3rd December, the function returns 22 December 2006. If
today is 26th December, then 22 January 2007 is returned. Can anyone help?
Reply With Quote
Justin Smith
View Public Profile
Find all posts by Justin Smith