According to U Doc Sir this will be the solution of my ProblemCode:Sub STEP12() If Dir("C:\Users\WolfieeeStyle\Desktop\ap.xls", vbNormal) = "" Then Exit Sub Dim Val As String, wb1 As Workbook, wb2 As Workbook, srcWS As Worksheet, desWS As Worksheet Dim i As Long, v1 As Variant, v2 As Variant, rngList As Object Set wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\ap.xls") Set wb2 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Files\AlertCodes.xlsx") Set desWS = wb1.Worksheets.Item(1) Set srcWS = wb2.Worksheets.Item(1) v1 = desWS.Range("E2", desWS.Range("E" & desWS.Rows.Count).End(xlUp)).Value v2 = srcWS.Range("A2", srcWS.Range("A" & srcWS.Rows.Count).End(xlUp)).Resize(, 2).Value Set rngList = CreateObject("Scripting.Dictionary") For i = 1 To UBound(v1, 1) Val = v1(i, 1) If Not rngList.exists(Val) Then rngList.Add Key:=Val, Item:=i + 1 End If Next i For i = 1 To UBound(v2, 1) Val = v2(i, 1) If rngList.exists(Val) Then desWS.Cells(rngList(Val), 25) = v2(i, 2) End If Next i Application.ScreenUpdating = True wb1.Save wb2.Save wb1.Close wb2.Close End Sub
Thnx Alot Doc Sir for helping me in solving this problem
I haven't run the macro yet
I will run it soon & I will check it
Thnx Sir




Reply With Quote

Bookmarks