Message box date format macro help

A

Aaron

Sub proving()
Worksheets("Proving Equipment").Visible = True
Sheets("Proving Equipment").Select
If (n62 + 31) < o62 Then
MsgBox ("Proving Equipment Expires Within 1 Month"),
vbInformation, "Proving Kit Check"
Else
'MsgBox ("No Probs"), vbInformation, "Proving Kit Check"
End If
End Sub

I have date formatted n62 and 062, and in the cells I have 16/05/09
and 16/06/09 but when I pause the macro mid stream and hover over the
n62 and o62 it says =empty.

Needless to say it doesent work unless I swap the <> sign around.

It always displays the first msg box unless i swap the <> then it
displays the other message box. Changing the dates doesent trigger the
change.

I want to allow 31 days before the first msg box pops up.

TIA

Aaron.
 
F

FSt1

hi
this line..
If (n62 + 31) < o62 Then
i'm not sure if VB is reading these as cell addess much less values in the
celll address ie syntax problem.
try this instead...
If [O62] - [N62] < 31 Then
or
if range("O62").value - range("N62").value > 31 then

both work.
regards
FSt1
 
F

FSt1

oops. the second line should have the sign reversed ie.
if range("O62").value - range("N62").value < 31 then

sorry
regards
FSt1

FSt1 said:
hi
this line..
If (n62 + 31) < o62 Then
i'm not sure if VB is reading these as cell addess much less values in the
celll address ie syntax problem.
try this instead...
If [O62] - [N62] < 31 Then
or
if range("O62").value - range("N62").value > 31 then

both work.
regards
FSt1

Aaron said:
Sub proving()
Worksheets("Proving Equipment").Visible = True
Sheets("Proving Equipment").Select
If (n62 + 31) < o62 Then
MsgBox ("Proving Equipment Expires Within 1 Month"),
vbInformation, "Proving Kit Check"
Else
'MsgBox ("No Probs"), vbInformation, "Proving Kit Check"
End If
End Sub

I have date formatted n62 and 062, and in the cells I have 16/05/09
and 16/06/09 but when I pause the macro mid stream and hover over the
n62 and o62 it says =empty.

Needless to say it doesent work unless I swap the <> sign around.

It always displays the first msg box unless i swap the <> then it
displays the other message box. Changing the dates doesent trigger the
change.

I want to allow 31 days before the first msg box pops up.

TIA

Aaron.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top