Results 1 to 2 of 2

Thread: Data from another worksheet

  1. #1
    Neophyte margib's Avatar
    Join Date
    Dec 2015
    Location
    Darwin
    Posts
    1
    Articles
    0

    Cool Data from another worksheet



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi,

    I have a spreadsheet with 5 columns. The last column has dates. I want all rows that have a date before today to automatically transfer to a new spreadsheet. How do I do this?

    Cheers,

  2. #2
    Magician navic's Avatar
    Join Date
    Aug 2013
    Location
    Europe, Croatia
    Posts
    869
    Articles
    0
    Excel Version
    Excel 2013

    Move Rows Data based on criteria Date in E column to another Sheet

    Quote Originally Posted by margib View Post
    How do I do this?
    I try made some procedure. Try in VBA Sheet1 module put this VBA macros
    Code:
    Sub MoveRowsData()
    'Move Rows Data with Criteria to New Row on Another Sheet
    Dim i, LastRow
    Application.EnableEvents = False
    LastRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To LastRow
    If Sheets("Sheet1").Cells(i, "E").Value < Date Then
    Sheets("Sheet1").Cells(i, "E").EntireRow.Cut Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
    Next i
    Application.EnableEvents = True
    DeleteRowsIfMatch 'call procedure to delete mowed-empty rows
    End Sub
    
    Sub DeleteRowsIfMatch()
    'Delete Empty Rows
        Dim endrow As Integer
            Dim src As Range, dest As Range
        On Error Resume Next
        endrow = Sheets("sheet1").Range("D65536").End(xlUp).Row
        For i = endrow To 1 Step -1
            tdate = Cells(i, 5).Value 
            If IsDate(tdate) = False And tdate = "" Then
               Cells(i, 5).EntireRow.Delete
            End If
        Next i
    End Sub
    My personal Web Excel Tutorials
    Attention! In the formulas as a delimiter I use a semicolon (; ) if you using my formula, then perhaps you need to use a comma (,)
    Also for a decimal number I use a comma (,) you may need to use point (.) instead of

Posting Permissions

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