Mini Tally VBA Code AtoZ
Mini Tally VBA Code AtoZ
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Data")
Dim i As Long
For i = 2 To lastRow
If ws.Cells(i, 2).Value = cboLedger.Value Then
lstLedger.AddItem ws.Cells(i, 1).Value
lstLedger.List(lstLedger.ListCount - 1, 1) = ws.Cells(i, 3).Value
lstLedger.List(lstLedger.ListCount - 1, 2) = ws.Cells(i, 4).Value
End If
Next i
End Sub
Email Function
Sub SendReportByEmail()
Dim outlookApp As Object
Dim outlookMail As Object
Dim filePath As String
With outlookMail
.To = "example@email.com"
.Subject = "Mini Tally Report"
.Body = "Please find the attached report."
.Attachments.Add filePath
.Send
End With