Consulting

Results 1 to 4 of 4

Thread: Delete row

  1. #1

    Delete row

    I will place the vba code in Report.xlsm
    my all files are located in same place
    Sheet name can be anything in both the files
    I need the vba code that will open both the file and do the process and save the file
    If cells of column C of basketorder.xlsx matches with cells of column B of 1.xlsx then delete the entire row of 1.xlsx(here entire row means the cells which matches delete that entire row)
    and after the process close and save the file so that changes should be saved
    Attached Files Attached Files

  2. #2
    This Problem is not Solved pending for the Solution
    And my dear frnd Volcanology If u have any Problem plz post it and explain each and everything in ur post and i am sure it will be Solved or u will be guided in a right way to solve ur problem

  3. #3
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi rider!
    Unzip the attachment and place it in the same path.
    Sub test()
    Dim pth$, arrOri, i&, d As Object, rng As Range
    Set d = CreateObject("scripting.dictionary")
    pth = ThisWorkbook.Path & "\"
    Application.ScreenUpdating = False
    Workbooks.Open pth & "BasketOrder.xlsx"
    arrOri = Sheets(1).[a1].CurrentRegion
    For i = 1 To UBound(arrOri)
      d(arrOri(i, 3)) = ""
    Next i
    ActiveWorkbook.Close False
    Workbooks.Open pth & "1.xls"
    With Sheets(1)
      For i = 2 To .Cells(Rows.Count, 1).End(3).Row
        If d.exists(.Cells(i, 2).Value) Then
          If rng Is Nothing Then Set rng = .Rows(i) Else Set rng = Union(rng, .Rows(i))
        End If
      Next i
      If Not rng Is Nothing Then rng.Delete
    End With
    ActiveWorkbook.Close True
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files

  4. #4
    Thnx Alot Sir for giving ur Precious Time and Great Support to this post
    Have a Great Day Sir

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
  •