Sir,
    This works fine.  I got what I expected.
Thanks.
Karunanithi R

________________________________
 From: Rajan_Verma <rajanverma1...@gmail.com>
To: excel-macros@googlegroups.com 
Sent: Thursday, April 12, 2012 12:11 AM
Subject: RE: $$Excel-Macros$$ $$excel-macro$$HOW TO EXTRACT DATA BETWEEN TWO 
DATES
 

See the attached file 
Try this:
 
Sub ExtractData()
    
    Dim rngRange As Range
    Dim rngCell As Range
    Dim rngUnion    As Range
    Dim dtStart As Date
    Dim dtEnd As Date
    Dim rngResult   As Range
    
    Set rngUnion = Range("A1:B1")
    Set rngRange = Range("A1").CurrentRegion
    dtStart = Range("rngStart").Value
    dtEnd = Range("rngEnd").Value
    
    If IsDate(dtStart) And IsDate(dtEnd) Then
        For Each rngCell In rngRange.Columns(2).Cells\
            If rngCell.Value >= dtStart And rngCell.Value <= dtEnd Then
               Set rngUnion = Union(rngUnion, rngCell.Offset(, -1).Resize(1, 2))
            End If
        Next
        Set rngResult = Application.InputBox("Please select a Cell to paste the 
Extracted Data", , , , , , , 8)
        rngUnion.Copy
        rngResult.PasteSpecial xlPasteAll
        Application.CutCopyMode = xlCopy
   Else
        MsgBox "Please Input a Correct Date", vbInformation
        Exit Sub
    End If
    
End Sub
 
Rajan.
 
From:excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On 
Behalf Of Jaysheel Bhasme
Sent: Apr/Wed/2012 11:55
To: excel-macros@googlegroups.com
Subject: Re: $$Excel-Macros$$ $$excel-macro$$HOW TO EXTRACT DATA BETWEEN TWO 
DATES
 
Hi,
 
Please find the attached sheet.
 
Jaysheel.
On Wed, Apr 11, 2012 at 11:48 PM, Rajan_Verma <rajanverma1...@gmail.com> wrote:
Please attached file
 
Rajan.
 
From:excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On 
Behalf Of karunanithi ramaswamy
Sent: Apr/Wed/2012 11:17
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ $$excel-macro$$HOW TO EXTRACT DATA BETWEEN TWO DATES
 
sir,
  I have list of staff with dates of retirement. I want to extract the staff 
who retire between 5/1/2012 and 5/31/2012.
I want the vba code to do this.
thank u in advance.
Karunanithi R
-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com
-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com


 
-- 
Jaysheel Bhasme.
-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com
-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to