check if is last day of month then, else

  • Thread starter Thread starter pswanie
  • Start date Start date
P

pswanie

i got a macro to copy and special paste data in order to get a accumalative
sales data. i want to add to it so that it check if today is the last day of
the month.

something like

if now() = lastday of month then
run macro
else
range a1.value = ""
end if


thanx
Phillip
 
Try this:

If Date = dateserial(year(date),Month(date)+1,0) then
'do something
Else
'do something else
End If


Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
The following is probably what you want...

If Date= DateSerial(Year(Date), Month(Date) + 1, 0) Then
' << Today is the last day of the month >>
Else
' << Today is not the last day of the month>>
End If

Notice I use the VBA Date function and not the VBA Now function (Now
contains time of day which is immaterial).

Rick
 
Another one...

if month(date) = month(date+1) then
'not the last day of the month
else
'is the last day of the month
end if
 
jip great stuff!!!!

worked.

(i should have said if yesterday were the last day. in other words check if
today is the first day of the month)

But ill play around with your answer

thanx

Phillip
 
Nice and concise, Dave....I like that approach.

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
Awww....Now you're just showing off! <g>

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 
Back
Top