Results 1 to 10 of 30

Thread: Delete rows based on match criteria in two excel files, 1 might be .csv file .Opened in Excel=Fail Chaos

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Code:
    Sub test2()
        Dim cars As Range
        Dim csv As Range
        
        Set cars = Workbooks.Open(ThisWorkbook.Path & "\1.xls") _
                    .Sheets(1).Cells(1).CurrentRegion
                    
        Set csv = Workbooks.Open(ThisWorkbook.Path & "\BasketOrder..csv") _
                    .Sheets(1).Cells(1).CurrentRegion.Columns("C")
        
        cars.Cells(2).Copy
        csv.Cells(1).Insert xlDown
        Set csv = csv.Offset(-1).Resize(csv.Cells.Count + 1)
        
        cars.AdvancedFilter xlFilterInPlace, csv
        cars.Offset(1).EntireRow.Delete
        cars.Parent.ShowAllData
        
        cars.Parent.Parent.Close True
        csv.Parent.Parent.Close False
        
    End Sub

    Problem Solved




    ** Cross Post.. mrexcel.com _ https://www.mrexcel.com/forum/excel-...ntire-row.html
    Last edited by DocAElstein; 09-01-2019 at 02:41 PM. Reason: Added code dtags and MrExcel Cross Post info

Similar Threads

  1. Delete One Row From A 2D Variant Array
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 18
    Last Post: 02-23-2020, 03:10 PM
  2. Replies: 6
    Last Post: 03-26-2014, 03:04 PM
  3. Replies: 1
    Last Post: 02-25-2014, 10:55 PM
  4. Delte a specific column and does not delete the top row
    By jffryjsphbyn in forum Excel Help
    Replies: 1
    Last Post: 06-13-2013, 02:00 PM
  5. Replies: 4
    Last Post: 03-22-2013, 01:47 PM

Tags for this Thread

Posting Permissions

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