Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to copy data with a date criteria

Help is needed:

I have the following spreadsheet:

A b c d e
Crse1 01/08/07 08/08/07 16/08/07 23/08/07
Crse2 08/08/07 16/08/07 23/08/07 30/08/07
crse3 16/08/07 23/08/07 30/08/07 8/09/07

This is just a small part of the spreadsheet, it's about 300 rows and 40
columns.

I need the macro to copy all the data in each row into another spreadsheet
if the date in any of the colums matches a specific date, todays date as this
will be run on each day.

Eg todays date 08/08/07, so this would return the data in column A for rows
1 & 2 but not column 3.

Any help will be greatly appreciated.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to copy data with a date criteria

Try this code

Sub copydata()
Const OldSheet = "Sheet1"
Const NewSheet = "Sheet2"

NewSheetRow = 1
With Sheets(OldSheet)
LastCol = .Cells(1, Columns.Count). _
End(xlToLeft).Column

RowCount = 1
Do While (.Cells(RowCount, "A"). _
Value < "")
Set RowRange = .Range(.Cells(RowCount, _
"B"), .Cells(RowCount, LastCol))
For Each cell In RowRange

If cell = Int(Now()) Then
.Rows(RowCount).Copy _
Destination:= _
Sheets(NewSheet). _
Rows(NewSheetRow)
NewSheetRow = NewSheetRow + 1
End If
Next cell
RowCount = RowCount + 1
Loop
End With
End Sub


"HelpLou07" wrote:

Help is needed:

I have the following spreadsheet:

A b c d e
Crse1 01/08/07 08/08/07 16/08/07 23/08/07
Crse2 08/08/07 16/08/07 23/08/07 30/08/07
crse3 16/08/07 23/08/07 30/08/07 8/09/07

This is just a small part of the spreadsheet, it's about 300 rows and 40
columns.

I need the macro to copy all the data in each row into another spreadsheet
if the date in any of the colums matches a specific date, todays date as this
will be run on each day.

Eg todays date 08/08/07, so this would return the data in column A for rows
1 & 2 but not column 3.

Any help will be greatly appreciated.

Thanks


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 copy with criteria puiuluipui Excel Discussion (Misc queries) 8 September 19th 09 11:30 AM
macro copy data wb1 matching date to wb2 Macromute Excel Discussion (Misc queries) 0 August 7th 07 07:16 AM
macro copy data from one workbook to other by matching date Tiger Excel Discussion (Misc queries) 0 July 27th 07 05:58 AM
Attempting to copy/paste data from one worksheet to another (same info but diff layout) based on date criteria tdb770 Excel Programming 1 February 27th 07 03:17 PM
Macro or formula to copy data based on criteria MT[_2_] Excel Programming 1 September 5th 05 03:03 PM


All times are GMT +1. The time now is 09:51 PM.

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"