LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Copying data from a table based on two date values

Hi,

You can do it like this.
Sheet 1 contains all your data with date in first column.
On Sheet2, cell A1 has "start date" and A2 has "end date".
When you run this macro, all data between the two dates will be copied to
sheet3.

Sub daterange()
j = 1
For i = 1 To Sheet1.UsedRange.Rows.Count
If (Sheet1.Cells(i, 1) = Sheet2.Cells(1, 1) And Sheet1.Cells(i, 1)
<= Sheet2.Cells(2, 1)) Then
Sheet1.Rows(i).Copy Sheet3.Rows(j)
j = j + 1
End If
Next i
End Sub

I hope that this will serve your purpose.

Thanks,
Aamer

Kirsty wrote:
Hi,

I have a table in one worksheet. I want to select a range of data from that
table. The range is between two dates, which are in cells on a second
worksheet.
I then want to copy and paste the selected data to a worksheet utilising a
macro.

How is this done


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200901/1

 
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
Copying a row based on date na Excel Worksheet Functions 2 September 10th 08 07:45 PM
Macro for copying and pasting values based on criteria Leigh Douglass[_2_] Excel Programming 3 January 28th 08 04:34 PM
Copying across values based on criteria Zak Excel Programming 13 January 24th 08 10:39 AM
summing values in a data table based on criteria in another column Dave F Excel Worksheet Functions 7 August 26th 06 04:36 PM
Copying rows based on date flurry[_5_] Excel Programming 4 June 3rd 06 06:05 PM


All times are GMT +1. The time now is 02:07 PM.

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

About Us

"It's about Microsoft Excel"