QUESTION: , I would like to ask you for help. I need to display a msgbox in case of two cells are not same. The procedure would be as follows. Check two cell (e.g. column A, row 10 and column A, row 11), 5day befor the end of the month, if the value are not same, then display msgbox.
Could you help me please? Thank you very much and have a nice weekend. Martin
ANSWER: martin,
I don't know what you mean by 5day befor the end of the month.
Sub abc()
if Range("A10").value <> Range("A11").value then
msgbox "A10 <> A11"
else
msgbox "A10 = A11"
end if end Sub
---------- FOLLOW-UP ----------
QUESTION: , thank you for your prompt reply. Sorry for my poor desciption, I try to more specify what I would like to do. I need to set something like a trigger, which will activate the procedure after a push-button operation. If I push the button from another macro in the actual month (e.g. Nov = 30days, i.e. 30-5 = 25th Nov) befor 25th Nov, then nothing and if I push the button after 25th Nov, then check the cells and display the msgbox.
I hope it helps. Thank you very much. Martin
Martin,
you can get the date of end of the current month with
Dateserial(year(date),month(date)+1,0)
so
Sub abc() if date >= Dateserial(year(date),month(date)+1,0) - 5 and _
date <= Dateserial(year(date),month(date)+1,0) then
if Range("A10").value <> Range("A11").value then
msgbox "A10 <> A11"
else
msgbox "A10 = A11"
end if End if end Sub
Advertisement