Hi guys- i'm quite new to vba and i've been following some of the guidance on this site which has been really useful. Unfortunately i'm just really stuck on something.
1.jpg
I have produced a spreadsheet where I enter checkmarks (as an "X") and it cycles through the columns and when it finds an X (with no "sent" alongside) it composes an email to an address on the same row in addition to adding a "sent" to the next column. My code is below
x = 9 'column I'
For x = 9 To 35
For Each Cell In Columns(x).Cells.SpecialCells(xlCellTypeConstants)
If Cell.Value = "X" And Cell.Offset(, 2).Value <> "sent" Then
Cell.Offset(, 2).Value = "sent"
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.Display
.to = Cells(Cell.Row, "E")
.CC = Cells(Cell.Row, "F")
.Subject =
.HTMLBody = strbody & Cells(Cell.Row, "D") & "," & "<br><br>" & strbody1 & Cells(3, Cell.Column) & strbody2 & .HTMLBody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next Cell
Next x
This works really well but I need to add another thing which I just cant seem to do. In the email I now need to compile a list of the previous "X" in terms of the dates (in the displayed example it would be 01 Oct but if there were more than one X on the row all those dates need to be listed). I've tried some ideas but nothing seems to work within my existing code.
Any suggestions?
Bookmarks