Forum Discussion
Aprile
Jan 21, 2025Copper Contributor
Email to be sent when a content is entered in a cell in Excel
Is it possible to set up an automated email notification when a specific cell in an Excel spreadsheet is updated? I'm responsible for tracking reimbursements for expense reports for a number of empl...
NikolinoDE
Jan 26, 2025Platinum Contributor
Maybe you can use VBA to monitor changes in certain cells and trigger an email via Outlook.
I haven't tried it, but here's an approach. Since I haven't tried the code, please save your file first to be on the safe side.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Dim MyEmail As Object
' Specify the cell to monitor (update this as per your needs)
Set KeyCells = Me.Range("B2") ' Change B2 to the cell you want to monitor
If Not Application.Intersect(KeyCells, Target) Is Nothing Then
' Get relevant data from the worksheet
Dim Name As String
Dim DateOfReport As String
Dim OutOfPocketExpenses As String
Name = Me.Range("A1").Value ' Cell where employee name is stored
DateOfReport = Me.Range("A2").Value ' Cell for date of report
OutOfPocketExpenses = KeyCells.Value ' Updated cell value
' Prepare email
Set MyEmail = CreateObject("Outlook.Application").CreateItem(0)
With MyEmail
.To = "email address removed for privacy reasons" ' Replace with your email
.Subject = "Out-of-Pocket Expense Update"
.Body = "Employee Name: " & Name & vbCrLf & _
"Report Date: " & DateOfReport & vbCrLf & _
"Out-of-Pocket Expenses: " & OutOfPocketExpenses
.Send ' Or use .Display to preview before sending
End With
End If
End SubHope this helps you...if not, just ignore it.