help with WorkSheet.Function.CountA someone pleeaasssse

EDUB7

New Member
Joined
Mar 9, 2016
Messages
4
Set OutLookApp = CreateObject("OutLook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
With OutLookMailItem
For iCounter = 6 To WorksheetFunction.CountA(Columns(4))
MailDest = ""
If MailDest = "" And Cells(iCounter, 4).Offset(0, -1) = "Send Reminder" Then
MailDest = Cells(iCounter, 4).Value
ElseIf MailDest <> "" And Cells(iCounter, 4).Offset(0, -1) = "Send Reminder" Then
MailDest = MailDest & ";" & Cells(iCounter, 4)
End If

Next iCounter
.To = MailDest
.BCC = "xyz@gmail.com"
.Subject = "Field Start-Up Reminder"
.Body = "Reminder: Start-Up for Project is now required. Please ignore if email if request has already been made."
.Send

End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing

I can't the worksheet.Function.CountA (Columns(4)) to work properly. It will run through the entire code without picking up the email that is listed in column 4. I must be missing some Monday detail. Can someone please help me with this???

-Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If you are trying to get it to loop until the last used cell in column D try...

Code:
For iCounter = 6 To Range("D" & Rows.Count).End(xlUp).Row

I haven't tried the rest of your code but I would think that
Code:
MailDest = ""

should be before the loop starts.
 
Last edited:
Upvote 0
Have you tried:

For iCounter = 6 To Application.WorksheetFunction.CountA(Columns(4))
or
For iCounter = 6 To Application.WorksheetFunction.CountA(Range("D:D"))
 
Upvote 0
I actually went with both of your comments. However, my goal is for the email to not resend to email addresses already notified. So I'm wondering if a loop isn't the right way to go at all?
 
Upvote 0

Forum statistics

Threads
1,215,359
Messages
6,124,488
Members
449,166
Latest member
hokjock

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top