Hi all,

Having an issue, was given an old Excel sheet with some VBA on it. The idea is that when a range is filled on a certain page, it triggers an email. If there's no range, no email is triggered. I want to understand where the code references range "blank". I added a new sheet to the workbook and tried to copy-paste the code to the new parameters, but its not picking up the range for the email even when it is filled. Not sure why and if someone could help or suggest an alternative I'd be very appreciative!

The code looks like this:

If Range("Blank").Value > 0 Then
info = Range("Blank"). Value + 1
Set rng = Sheets("Sheet 1").Range("D1:R" & info)
Sec1 = Range("Line 1").Value & " " & Range("BlankName"). Value & "," & "<br><br>" & Range("Line 2").Value & "<br>"
Sec2 = Range("Line 4").Value & "<br><br>" & Range("Line 5").Value
OnError GoTo 0.

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set OutApp = CreateObject("OutlookApplication")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = Range("BlankNameTo")
.CC = ""
.BCC = ""
.Subject = ""
.HTMLBody = Sec1 & RangetoHTML(rng) & "<br>" & Sec2
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True

Set OutMail = Nothing
Set OutApp = Nothing