Hi,
I'm trying to get a For Next loop working however I keep getting a Run-time error '13' : Type mismatch error popping up. Here is my code:
Column G is where the vlookup is located. There are some values which the vlookup can't find and it's returning the #N/A error. I think this is where the Type mismatch error is happening. What I want the code to do is when it finds a match to the value in the "Line" cell, it copies the entire row and pastes it into the other sheet. If it encounters an error, I want it to skip to the next cell and keep searching for a match to the "Line" cell until it gets to the end of the range. I'm using 2003 version of Excel.Line = Sheets("Page 1").Range("D9").Value - (the value in this cell is text or a string) For Each x In Range ("G5:G2000") If x = Line Then x.EntireRow.Copy Sheets("Page 2").Select Next Row = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(NextRow, 1).Select ActiveSheet.Paste Else NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(NextRow, 6).Select End If Next x