PDA

View Full Version : [SOLVED] Delete row



rider@1234
09-02-2019, 08:59 AM
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

rider@1234
09-04-2019, 05:45 AM
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

大灰狼1976
09-06-2019, 11:53 PM
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

rider@1234
09-07-2019, 05:52 AM
Thnx Alot Sir for giving ur Precious Time and Great Support to this post
Have a Great Day Sir