Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Select all rows in a date range

I have two dates - a start date in A1 and an end date in B1. I want to select
all rows containing dates in that range, copy them and paste to a new
worksheet within the same workbook. The date column is sorted early to late
dates.
--

Best regards,

Drew Yallop
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Select all rows in a date range

Public Sub Test()
Dim StartRow As Long
Dim EndRow As Long

With ActiveSheet

On Error Resume Next
StartRow = Application.Match(CLng(.Range("A1").Value),
..Range("rngDates"), 0)
On Error GoTo 0

If StartRow = 0 Then

MsgBox "Start date not matched"
Exit Sub
End If

On Error Resume Next
EndRow = Application.Match(CLng(.Range("B1").Value),
..Range("rngDates"), 0)
On Error GoTo 0

If EndRow = 0 Then

MsgBox "End date not matched"
Exit Sub
End If

.Range("rngDates").Cells(StartRow, 1).Resize(EndRow - StartRow +
1).Copy _
Worksheets("Sheet2").Range("A1")
End With
End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"thomasDrew" wrote in message
...
I have two dates - a start date in A1 and an end date in B1. I want to
select
all rows containing dates in that range, copy them and paste to a new
worksheet within the same workbook. The date column is sorted early to
late
dates.
--

Best regards,

Drew Yallop



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
Select a range of rows to delete Donna[_3_] Excel Worksheet Functions 2 January 26th 10 07:32 PM
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
Select range of rows/Columns? Cam Excel Programming 3 August 28th 07 09:01 PM
Select always same Rows range Nauj Solrac Excel Discussion (Misc queries) 2 April 26th 07 08:10 PM
How to select rows containing certain date jessica Excel Programming 3 October 14th 03 01:17 PM


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

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"