Auto email before save if criteria is met

snowboy001

Board Regular
Joined
Dec 5, 2009
Messages
100
I have some macro's that are tracking changes on each sheet in my workbook. If there are changes detected, it puts a "1" in cell A1 of a hidden sheet (named "Sheet1" for this demonstration). I am wanting to run a BeforeSave event to check for that "1", and if it is there, send an email out to my group to notify them.

Here is what I am thinking...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

'run macros to update changes, and put a "1" in cell A1 of the hidden sheet
If Sheets("Sheet1").Range("A1").Value = "1" Then
'code to send out email to my group (I already have this code)
End If
End Sub

The part in red is what I am having trouble with.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Still doesn't work. Usually when I type Sheets("Sheet1"). it pulls up a list of values, and in this module, it is not even doing that. Kind of like it's not enen acknowledging the command.
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,047
Members
448,940
Latest member
mdusw

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top