Tommy Snoberg Soderberg
New Member
- Joined
- Mar 3, 2021
- Messages
- 17
- Office Version
- 365
- Platform
- Windows
Hi,
I want to create a makro that loops until there's no more entries in my excelsheet where I get the data from. I.e. It should stop looping when there is a blank cell.
As a real beginner in VBA I'm not sure how I can insert som code into my existing code for that to work. I bet there's a real easy solution for it.
Sub Email_From_Excel_Attachments()
Dim emailApplication As Object
Dim emailItem As Object
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)
Sheets("Adresses").Select
emailItem.To = Range("B2").Value
emailItem.cc = Range("C2").Value
emailItem.Subject = Range("D2").Value & Date
emailItem.Body = Range("E2").Value
emailItem.Attachments.Add Range("F2").Value
emailItem.Send
End Sub
I want to create a makro that loops until there's no more entries in my excelsheet where I get the data from. I.e. It should stop looping when there is a blank cell.
As a real beginner in VBA I'm not sure how I can insert som code into my existing code for that to work. I bet there's a real easy solution for it.
Sub Email_From_Excel_Attachments()
Dim emailApplication As Object
Dim emailItem As Object
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)
Sheets("Adresses").Select
emailItem.To = Range("B2").Value
emailItem.cc = Range("C2").Value
emailItem.Subject = Range("D2").Value & Date
emailItem.Body = Range("E2").Value
emailItem.Attachments.Add Range("F2").Value
emailItem.Send
End Sub