Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying a row based on date | Excel Worksheet Functions | |||
Macro for copying and pasting values based on criteria | Excel Programming | |||
Copying across values based on criteria | Excel Programming | |||
summing values in a data table based on criteria in another column | Excel Worksheet Functions | |||
Copying rows based on date | Excel Programming |