task to send email from excel.
Below is the example column. How I can get the email value from the loop?
Thanks
Here is my code :
Dim rng As Range
Dim row As Range
Dim cell As Range
Dim mydate As Date
Dim myDiff As LongSet rng = Range("E5:E17")
Set rng2 = Range("F5:F17")
Dim cell2 As RangeDim i As Integer
i = 5For Each row In rng.Rows
For Each cell In row.CellsMsgBox cell.Value
mydate = cell.Value
myDiff = DateDiff("d", Date, mydate)
Set rng2 = Range("F" & i)
For Each cell2 In rng2
MsgBox cell2.Value
Next cell2If myDiff > -8 And myDiff < 8 Then
aEmail.Send
End Ifi = i + 1
Next cell
Next row
Answer
I think you need this ..
Dim n as Integer
For n = 5 to 17
msgbox cells(n,3) '--> sched waste
msgbox cells(n,4) '--> type of treatm
msgbox format(cells(n,5),"dd/MM/yyyy") '--> Lic exp
msgbox cells(n,6) '--> email col
Next
No comments:
Post a Comment