PDA

View Full Version : [SOLVED] Check Month and Day



stapuff
05-12-2005, 08:46 AM
Not sure how to write this piece for a macro properly -


If sheets("Actual").range("e2") = current month & system day is > 7 then
sheets("Actual").range("g2") = sheets("Data").range("J1")
end if

Thanks,

Kurt

Cyberdude
05-12-2005, 09:05 AM
I'm not clear on what you are comparing. Are you trying to detect if the current day of the current month is greater than 7? If so, then you can use the "Day" function like:
If Day(Date) > 7 ...

stapuff
05-12-2005, 09:13 AM
Cyberdude -

I want to check to see if the cell = current month and that the system day > 7

Today is 5/12/05

Current month is May: E2 = May and system day is 12 which is greater than 7 so the if statement is true.

Thanks,


E2= 5/1/05
I want to verify e2 = current month (May) which it does and today is greater than the 7th day of the month.

Kurt

stapuff
05-12-2005, 10:05 AM
I've got it




If Day(Date) > 7 And Month(Range("E2")) = Month(Date) Then
Range("G2") = Sheets("Data").Range("J1")
End If