Hello,
I'm new to VBA and I'm having a little difficulty with a loop that is running to the end of worksheet instead of stopping at the last row in the column.
The second row of the code here seems to be the culprit. Any help is appreciated. Thanks.
Sub LTM()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To FinalRow
If IsNumeric(ActiveCell.Value) = True Then
ActiveCell.Offset(0, 22).Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=INDEX('NS Tie Out'!R1C1:R120C31,MATCH(Legacy!RC[-22],'NS Tie Out'!C1,0),MATCH(Legacy!R4C3,'NS Tie Out'!R7,0))"
ActiveCell.Offset(0, -22).Range("A1").Select
Selection.End(xlDown).Select
Else
Selection.End(xlDown).Select
End If
Next x
End Sub
I'm new to VBA and I'm having a little difficulty with a loop that is running to the end of worksheet instead of stopping at the last row in the column.
The second row of the code here seems to be the culprit. Any help is appreciated. Thanks.
Sub LTM()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To FinalRow
If IsNumeric(ActiveCell.Value) = True Then
ActiveCell.Offset(0, 22).Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=INDEX('NS Tie Out'!R1C1:R120C31,MATCH(Legacy!RC[-22],'NS Tie Out'!C1,0),MATCH(Legacy!R4C3,'NS Tie Out'!R7,0))"
ActiveCell.Offset(0, -22).Range("A1").Select
Selection.End(xlDown).Select
Else
Selection.End(xlDown).Select
End If
Next x
End Sub