I have written the following code to bring values from an external sheet into my workbook using a index match loop. If the error occurs the index/match formula it is supposed to retrieve another value from a worksheet within my current workbook.
The loop works until it gets to the first value that it is supposed to bring in from the worksheet within my current workbook.
And ideas on how I can fix the IF ISERROR loop to bring in the values?
Sub UpdateFile()
Dim wbMVRVFile As Workbook
Dim wbNewMV As Workbook
Dim wsRevFile As Worksheet
Dim wsMvFile As Worksheet
Dim wsMvOld As Worksheet
Dim wsRevOld As Worksheet
Dim wsNewMV As Worksheet
Dim wsTempFile As Worksheet
Dim FrRngCount As Range
Dim i As Integer
Dim b As Integer
Dim y As Integer
Set wbMVRVFile = Workbooks("Databook_2016.xlsm")
Set wsMvOld = wbMVRVFile.Worksheets(2)
Set wsRevOld = wbMVRVFile.Worksheets(1)
Set wsTempFile = wbMVRVFile.Worksheets("TempFile")
wbMVRVFile.Worksheets.Add().Name = "MV " & Format(DateSerial(Year(Date), Month(Date), 0), "dd-mm-yy")
Set wsMvFile = wbMVRVFile.ActiveSheet
Set FrRngCount = wsMvOld.Range("A:A")
i = Application.WorksheetFunction.CountA(FrRngCount)
wsTempFile.Range("A1:A" & i).Value = wsMvOld.Range("A1:A" & i).Value
Set wbNewMV = Workbooks.Open("F:\Reports\Data\NReport" & Format(DateSerial(Year(Date), Month(Date), 0), "yyyymmdd") & ".xls")
Set wsNewMV = wbNewMV.Worksheets(1)
Set FrRngCount = wsNewMV.Range("B:B")
y = Application.WorksheetFunction.CountA(FrRngCount)
b = i + y - 2
wsTempFile.Range("A" & i & ":A" & b).Value = wsNewMV.Range("B2:B" & y).Value
wsTempFile.Range("A1:A" & b).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=wsMvFile.Range("A1"), Unique:=True
Set FrRngCount = wsMvFile.Range("A:A")
y = Application.WorksheetFunction.CountA(FrRngCount)
'i = 2
For i = 2 To y
If Not IsError(wsMvFile.Range("B" & i) = Application.WorksheetFunction.Index(wsNewMV.Range("C1:C" & Cells(Rows.Count, "C").End(xlUp).Row), Application.WorksheetFunction.Match(wsMvFile.Range("A" & i), wsNewMV.Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row), 0), 1)) Then
wsMvFile.Range("B" & i) = Application.WorksheetFunction.Index(wsMvOld.Range("B1:B" & Cells(Rows.Count, "C").End(xlUp).Row), Application.WorksheetFunction.Match(wsMvFile.Range("A" & i), wsMvOld.Range("A1:A" & Cells(Rows.Count, "B").End(xlUp).Row), 0), 1)
End If
Next i
End Sub