Call Macro If x 2 Q

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Need a small bit of help, in calling a Macro (A below) if cell AE6>0,
if it is or isn't I still want to to test and run (B) below, do I have
the syntax of my End If's correct?

...........
(A) If Sheets("Sheet1").Range("AE6").Value > 0 Then

Mail_New_Version 'run this sub macro

Call UncheckBoxes
Call DelAllCheckBoxes


(B) If Weekday(Sheets("Input").Range("BF1")) = vbMonday _
And Sheets("E-Mail").Range("AE6").Value = 0 Then
MailToBobWeekly '<------ run this sub macro


Call UncheckBoxes
Call DelAllCheckBoxes

End If
End if
End Sub
 
try this
If Sheets("Sheet1").Range("AE6").Value > 0 Then
Mail_New_Version 'run this sub macro
Call UncheckBoxes
Call DelAllCheckBoxes
End If
If Weekday(Sheets("Input").Range("BF1")) = vbMonday _
And Sheets("E-Mail").Range("AE6").Value = 0 Then
MailToBobWeekly '<------ run this sub macro
Call UncheckBoxes
Call DelAllCheckBoxes
End if
 
I can't get the following extract of code to work, it doesn't execute
as I expect

My cells values are:-
AE6 = 0
BF1 = 18/02/08 i.e. Monday

Thus I expect Mail_New_Version to be 'skipped' and MailToBobWeekly to
execute. What am I doing incorrectly?

If Sheets("Input").Range("AE6").Value > 0 Then
Mail_New_Version '<-----run this sub macro
End If
If Weekday(Sheets("Input").Range("BF1")) = vbMonday _
And Sheets("Input").Range("AE6").Value = 0 Then
Call MailToBobWeekly '<---------run this sub macro
End If
 
I can't get the following extract of code to work, it doesn't execute
as I expect

My cells values are:-
AE6 = 0
BF1 = 18/02/08 i.e. Monday

Thus I expect Mail_New_Version to be 'skipped' and MailToBobWeekly to
execute. What am I doing incorrectly?

    If Sheets("Input").Range("AE6").Value > 0 Then
    Mail_New_Version      '<-----run this sub macro
    End If
    If Weekday(Sheets("Input").Range("BF1")) = vbMonday _
             And Sheets("Input").Range("AE6").Value = 0 Then
        Call MailToBobWeekly       '<---------run this sub macro
    End If

Hey Sean

Try to debug, if
debug.print Weekday(Sheets("Input").Range("BF1"))
gives you the correct output or not.

The code looks fine for me.

hth
Carlo
 
Fixed, I had the syntax of an e-mail address wrong and I didn't see
the error as I had an 'on error resume next' statement - Doh!
 
Fixed, I had the syntax of an e-mail address wrong and I didn't see
the error as I had an 'on error resume next' statement - Doh!

Hi Sean

glad that it worked out.

Just to answer your question if it matters that your cells are
formulas:
No, it doesn't matter, because you check your cells with .value, which
always gives you the value, not the formula.

hth
Carlo
 

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

Back
Top