Excel VBA - reading cell value from code

task to send email from excel. The following is an example column. How can I get the email value from the loop? Thanks

enter image description here

Here is my code:

  Dim rng as range
    Dim row as range
    Dim cell as range
    Dim mydate as date
    Dim mydiff as long

Set rng = Range ("E5: E17") Set rng2 = Range ("E5: E17") Dim cell2 As Range

Dim i As Integer i = 5

For each row In rng.Rows For each cell In row.Cells

MsgBox cell.Value mydate = cell.Value myDiff = DateDiff("d", Date, mydate) Set rng2 = Range("F" & i) For Each cell2 In rng2 MsgBox cell2.Value Next cell2 

If myDiff> -8 And myDiff <Then aEmail.Send End If

i = i + 1 Next cell Next line

+7
excel-vba excel
source share
1 answer

I think you need it.

 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 
+8
source share

All Articles