Hi
Code:
Sub STEP12()
    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


This is the macro
I need a slight change in it
If ap.xls files is present then only this macro will work & if ap.xls file is not present then it should not do anything
I can use on error resume next code in this macro but u have suggested not to use that
So i need help for the same