Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to send email BAKERSMAN Excel Discussion (Misc queries) 0 April 2nd 10 01:28 AM
A macro that will hide all but the last 20 dated rows. Mac0001UK Excel Discussion (Misc queries) 1 September 19th 08 08:45 AM
macro to send email scheduler Excel Discussion (Misc queries) 2 October 18th 07 11:20 PM
Buttons/1-add rows /2-auto save & name, close, send in email Friday All Nighter's No More-Please HELP Excel Programming 0 August 6th 06 11:07 AM
how do i send email from a macro dok112[_18_] Excel Programming 3 June 25th 04 03:30 AM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"