+ Reply to Thread
Results 1 to 4 of 4

Pick, copy and paste rows containing specific range of values

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    Copenhagen, Europe
    MS-Off Ver
    Excel 2010
    Posts
    2

    Pick, copy and paste rows containing specific range of values

    i have a sheet ("B")containing a range of values.

    One of these values is dates(column x).

    I need to run a macro, that will pick all rows from sheet "B", within date "date1" stated in a cell in Sheet "a", and "today" copy these, and paste them to sheet "C".

    Anyone who has some simple coding for that?

  2. #2
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Pick, copy and paste rows containing specific range of values

    Kennyd71,

    Try this and let me know if that is what you were looking for.


    Simeon
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-16-2012
    Location
    Copenhagen, Europe
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Pick, copy and paste rows containing specific range of values

    Thank you, S.
    That code was EXACTLY what i was looking for.
    Much obliged.


    Sub Copy_Data()

    Dim r As Long

    a = 2

    Sheets("B").Select

    For r = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
    If Cells(r, 24).Value <= Sheets("A").Range("A1").Value And Cells(r, 24).Value >= Sheets("A").Range("B2").Value Then
    Rows(r).Select
    Selection.Copy
    Sheets("C").Select
    Rows(a).Select
    ActiveSheet.Paste
    Sheets("B").Select
    a = a + 1
    End If

    Next r

    MsgBox "Date Range has been copied to Sheet C..."

    End Sub

  4. #4
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: Pick, copy and paste rows containing specific range of values

    Glad I could help!
    Don't forget to click the star in this post!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1