• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

VBA advice

Excel dates are being stored as a number. With the integer particle is holding the date and the time is being as a decimal, so you must comparing the integer part of date cellular with the integer part of current date/timing. Isn't It?

Assuming your dates are coming in column 5 (or 'E') and mail addresses column 2 ('B') and the address data most correctfully is in rows 4 to 20, in a worksheet being named 'Data', something like:


Sub SendSomeMail()

Const DATECOL = 5
Const MAILCOL = 2
Dim Row As Integer
Dim EmailAddress As String
Dim DataSheet As Worksheet

Set DataSheet = Worksheets("Data")
For Row = 4 To 20
If Int(DataSheet.Cells(Row, DATECOL).Value) = Int(Now()) Then
EmailAddress = DataSheet.Cells(Row, MAILCOL).Value
'' Mail Function here
End If
Next 'Row

End Sub

Needful done. Payment to Shawaddidi Consulting, Jersey.

Many thankings.

This may work with a bit of fiddling - thanks for that - I'll PM you if I get stuck and need a professional on the job :smile
 
if I get stuck and need a professional on the job

Have you been reading my diary? That sounds suspiciously like my plans for later this evening ...
 

Advertisers

Back
Top