# Help - Simple Macro (If Sum of Row>0, Then MsgBox, Else, Macro2)

#### JonesyUK

##### Board Regular
Hi All,

My spreadsheet contains a Macro ("SendEmail") which, when activated, will send the spreadsheet to a specific email address. It works fine.

I would like to add a new Macro that Checks the following, BEFORE running the "SendEmail" Macro:

1) If Sum(C52:M53)<=1, MsgBox "Please Enter your Data in Rows 22 & 23"
3) If Sum(C52:M53) >1 AND Sum(C97:M97)=0, Then "SendEmail"

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.

#### VoG

##### Legend
Try

Code:
``````If WorksheetFunction.Sum(Range("C52:M53")) <= 1 Then
Exit Sub
End If
If WorksheetFunction.Sum(range("C97:M97")) > 0 Then
Exit Sub
End If
Call SendEmail``````

#### JonesyUK

##### Board Regular
Thanks for that... your first If statement works fine. However, it seems to ignore the second If statement. Does it matter that there are formulas in the cells in C97:M97?

#### JonesyUK

##### Board Regular
Not to worry - my mistake... works perfectly.... Thanks!

Replies
10
Views
444
Replies
0
Views
420
Replies
1
Views
207
Replies
5
Views
254
Replies
9
Views
307

1,195,937
Messages
6,012,410
Members
441,698
Latest member
DaveTeo

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back