Guna13
Board Regular
- Joined
- Nov 22, 2019
- Messages
- 70
- Office Version
- 365
- Platform
- Windows
Hello,
After Multiple tried, i did few code work, based on data. But I am not able to create emails for List of Users one by one Instead Single shot email for all Users?
If No User data, then No need to Send email. Kindly suggest me.
I need to send email to Individual Users with Body of contain in that Each Line with Header Wise.
Request you to make short Macro code, instead of my code is lengthy code.
Sub Macro1()
Dim sToday As String
Set Sh = Sheet1
Set Ws = Sheet2
Ws.Cells.Clear
lr = Sh.Range("A" & Rows.Count).End(xlUp).Row
Trgv = "Earn Leave"
sToday = Format(Date + 1, "MMM-DD")
Sh.Activate
Sh.Cells.Find(What:=sToday, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Sh.Range("A1:A" & lr, "C1:C" & lr).Copy Ws.Range("A1")
ActiveCell.EntireColumn.Copy Sheets("Sheet2").Cells(1, 4)
Application.CutCopyMode = False
lr = Ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 2 Step -1
If Ws.Range("D" & i) <> "Earn Leave" Then
Ws.Range("D" & i).EntireRow.Delete
End If
Next i
End Sub
After Multiple tried, i did few code work, based on data. But I am not able to create emails for List of Users one by one Instead Single shot email for all Users?
If No User data, then No need to Send email. Kindly suggest me.
I need to send email to Individual Users with Body of contain in that Each Line with Header Wise.
Request you to make short Macro code, instead of my code is lengthy code.
Sub Macro1()
Dim sToday As String
Set Sh = Sheet1
Set Ws = Sheet2
Ws.Cells.Clear
lr = Sh.Range("A" & Rows.Count).End(xlUp).Row
Trgv = "Earn Leave"
sToday = Format(Date + 1, "MMM-DD")
Sh.Activate
Sh.Cells.Find(What:=sToday, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Sh.Range("A1:A" & lr, "C1:C" & lr).Copy Ws.Range("A1")
ActiveCell.EntireColumn.Copy Sheets("Sheet2").Cells(1, 4)
Application.CutCopyMode = False
lr = Ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 2 Step -1
If Ws.Range("D" & i) <> "Earn Leave" Then
Ws.Range("D" & i).EntireRow.Delete
End If
Next i
End Sub
Location | Staff No. | Name | Dec-12 |
India | 13242143213 | ANBUVEL BLALAJI | Earn Leave |
India | 21432142314 | AISHWEARYA RKDIASFD | Earn Leave |
India | 12343214321 | RAVEENA EDELVALV | Earn Leave |
India | 21343214123 | KRITHIKA MANIASFLASFD | Earn Leave |