dimanche 23 août 2020

How to get a macro to end loop based off the last row in a column?

I've recorded a macro, but I would like the code to stop executing based off the last row in column A.

The recorded Macro code

ActiveCell.FormulaR1C1 = 

    "If(OR(RC[-2]=""X"",RC[-2]=""Y""),VLOOKUP(RC[-3},XYZ!RC[-4]:R[138]C[85],87,0),"""")"

Range("E2").Select

Application.CutCopyMode = FALSE

Selection.Copy

Range(Selection, Selection.End(xlDown)). Select

Range("A2").Select

Selection.End(xlDown).Select

Range("E400").Select

Range(Selection, Selection.End(xlUp)). Select

Range(Selection, Selection.End(xlUp)). Select

ActiveSheet.Paste

Application.CutCopyMode = False

Ultimately,I would like the formula in column E to stop looping based off the last row in column A

Aucun commentaire:

Enregistrer un commentaire