Code: Select all
LastRow = Cells(Rows.Count, "Y").End(xlUp).Row
What I'm trying to do in the code is to subtract two columns and to place the result in column AA. My data row starts from row 5. I have headings in row 3 and 4.
Code: Select all
Sub Subtract()
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Report")
LastRow = Cells(Rows.Count, "Y").End(xlUp).Row
ws.Range("AA5:AA" & LastRow) = Evaluate("Y5:Y" & LastRow & "-Z5:Z" & LastRow)
End Sub