So I'm really new to VBA (and by new I mean a couple of days in). I'm looking to make a loop that will incrementally add lines to an email body if a certain condition is met. I apologise in advance if it is horrible to read but it does seem to work so far! If anyone can tell me how I can add something to the loop so that it adds a new line to the email body every time the condition is met, I would appreciate it.
Here's what I have so far:
Sub SendEmailReminder()
Dim x As Integer
Dim Removal As String
Dim RemovalTitle As String
Removal = Removal
RemovalTitle = RemovalTitle
' Set numrows = number of rows of data.
numrows = Range("C2").End(xlDown).row - 1
' Select cell 2.
Range("C2").Select
' Establish "For" loop to loop "numrows" number of times.
For x = 1 To numrows
If ActiveCell = Date - 30 Then
Removal = ActiveCell.Offset(0, -2)
RemovalTitle = ActiveCell.Offset(0, -1)
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = Removal & " - " & RemovalTitle & " needs to be removed from New Releases"
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.Body = strbody
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
' Selects cell down 1 row from active cell.
ActiveCell.Offset(1, 0).Select
Next
End Sub