I have two workbooks which use the following code. The problem is it is possible at some point for one or both of the files to only have a header row and one row of data. In the case of the of the latter the End(xlDown) method will go throw every row in the spreadsheet. How can I avoid that, but still have the code work with there is more than one row after the header?
Code:
For Each CurtCellRng In Range(Range("K2"), Range("K2").End(xlDown))
If CurtCellRng.Value = 0 Then
CurtCellRng.Value = Cells(CurtCellRng.Row, "I").Value
Cells(CurtCellRng.Row, "I").Value = 0
Else
CurtCellRng.Value = 0
End If
Next CurtCellRng