Minor changes are there in this post
Code:Sub STEP9() Dim Wb1 As Workbook, Wb2 As Workbook, Wb3 As Workbook Set Wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\1.xls") Set Wb2 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Alert..csv") Set Wb3 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Files\AlertCodes.xlsx") Dim Ws1 As Worksheet, Ws2 As Worksheet, Ws3 As Worksheet Set Ws1 = Wb1.Worksheets.Item(1) Set Ws2 = Wb2.Worksheets.Item(1) Set Ws3 = Wb3.Worksheets.Item(2) Dim Lr1 As Long, Lr2 As Long, Lr As Long, Lr3 As Long Let Lr1 = Ws1.Range("A" & Ws1.Rows.Count).End(xlUp).Row Let Lr2 = Ws2.Range("A" & Ws1.Rows.Count).End(xlUp).Row Dim Cnt For Cnt = 2 To Lr3 Dim VarMtch As Variant Let VarMtch = Application.Match(CStr(Ws1.Range("I" & Cnt & "").Value), Ws2.Range("B2:B" & Lr2 & ""), 0) If Not IsError(VarMtch) Then Else Ws1.Range("B" & Cnt & ",I" & Cnt & "").Copy Let Lr3 = Lr3 + 1 Ws3.Range("A" & Lr3 & "").PasteSpecial Paste:=xlPasteValues End If Next Cnt Wb1.Save Wb1.Close Wb2.Save Wb2.Close Wb3.Save Wb3.Close End Sub
the result was pasted in Ws22
but we have to paste the data(result to Ws3)
i changed the code and i tried to edit the same but i was unsuccessful in doing so plz see the code and change the vba code so that the result should be pasted in Ws3




Reply With Quote

Bookmarks