View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default check for last day of month

On Wed, 26 Sep 2007 14:54:42 -0400, Ron Rosenfeld
wrote:

On Mon, 24 Sep 2007 13:58:00 -0700, pswanie
wrote:

i need a mocro to check if its the last day of the month and if so del
contents in cell a1


for example

chek if day = 31 then del range a1. if only 30 days in month then
chek if day = 30 then del range a1. if only 28 days in month then
chek if day = 28 then del range a1. if non of above then nothing

it can use the system date to chek what month is the current month




Sub ClearAtEOM()
If Day(Date + 1) < Day(Date) Then [a1].ClearContents
End Sub


--ron


I see JW has posted an even simpler method:

If Day(Date + 1) = 1 Then [a1].ClearContents


--ron