Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to place dated rows in email and send???
Hi, I have a worksheet that has rows that are dated.
What I'm looking for is a macro that copies the current day's rows (there can be more than one row with the current date) and then put it in an email and send it. I have tried recording a macro to do it but have had no success. Any help is great. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to place dated rows in email and send???
The following method will check for valid rows. In my example, the data
is organized as this: [date] [value] <-- column A holds the dates, column B holds the data Example: 2006-10-11 (column A) values (column B) The method will NOT email the results. Just hit Google with "Excel vba send mail" and you will have plenty of examples. Your problem with finding the correct cells can be solved in numerous ways, here it one I've succesfully tested. Sub FetchTodaysRows() Dim ws As Worksheet Dim rngData As Range Dim c As Range Dim strOut As String 'worksheet containing data Set ws = Worksheets("mydata") 'the range where the data is Set rngData = ws.Range("A1:A10") For Each c In rngData If c.Value = Date Then strOut = strOut & c.Value & " " & c.Offset(0, 1).Value & Chr(10) End If Next c Debug.Print strOut End Sub Please note: ..Offset(0,1).Value <-- gives the value of column b Chr(10) <-- add a line feed -Fredrik |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to send email | Excel Discussion (Misc queries) | |||
A macro that will hide all but the last 20 dated rows. | Excel Discussion (Misc queries) | |||
macro to send email | Excel Discussion (Misc queries) | |||
Buttons/1-add rows /2-auto save & name, close, send in email | Excel Programming | |||
how do i send email from a macro | Excel Programming |