Code: Select all
Sub STEP3()
Dim Wb1 As Workbook, Wb2 As Workbook
Set Wb1 = Workbooks.Open("C:\Users\**I've been banned**\Desktop\1.xls")
Set Wb2 = Workbooks.Open("C:\Users\**I've been banned**\Desktop\Hot Stocks\H2.xlsb")
Dim Ws1 As Worksheet, Ws2 As Worksheet
Set Ws1 = Wb1.Worksheets.Item(1)
Set Ws2 = Wb2.Worksheets.Item(2)
Dim Lr1 As Long, Lr2 As Long: Let Lr1 = 5000: Lr2 = 5000
Dim rngSrch As Range: Set rngSrch = Ws2.Range("A2:A" & Lr2 & "")
Dim rngDta As Range: Set rngDta = Ws1.Range("B2:B" & Lr1 & "")
Dim Cnt As Long
For Cnt = Lr2 To 1 Step -1
Dim MtchedCel As Variant
Set MtchedCel = rngSrch.Find(what:=rngDta.Item(Cnt), After:=rngSrch.Item(1), LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlNext, MatchCase:=True)
If Not MtchedCel Is Nothing Then
Else
rngDta.Rows(Cnt).EntireRow.Delete Shift:=xlUp
End If
Next Cnt
Wb1.Close SaveChanges:=True
Wb2.Close SaveChanges:=True
End Sub
I have to remove the limitations of this macro
I have issue with this Lr1 in this macro
Bco'z of Lr1 this macro has limitations
The macro is working perfect No Doubt In it
But due to this Lr1, it works only for 5000 data
what if there is more data in the file
So i want to remove the limitation of this macro
So plz have a look and do needful
Thnx Alot