So - I have a soft coded formula that I want inserted in a cell in the last row that contains data, and ONLY the last row
For example: If my last Row with Data is Row 9, I would like the formula in cell P9 to calculate =J9 + K9
Likewise, if my last row of data is in Row 17, I would like the formula in cell P17 to calculate = J17 + K17
Likewise, if my last row of data is in Row *, I would like the formula in cell P17 to calculate = J* + K*
I tried to use
But it's taking the data from N1 instead of N*. Any suggestions? I also googled for a way to soft code the row number based off of the current row, but couldn't find anything. The ROW function didn't do me any good.
The other thing I can think of is to copy it all of the way down to the last row. and then use another macro to clear all of the rows down to the row above it. But, it's getting late. I'll try that in a few days when I get back to my project, but any other ideas until them would be appreciated.
For example: If my last Row with Data is Row 9, I would like the formula in cell P9 to calculate =J9 + K9
Likewise, if my last row of data is in Row 17, I would like the formula in cell P17 to calculate = J17 + K17
Likewise, if my last row of data is in Row *, I would like the formula in cell P17 to calculate = J* + K*
I tried to use
Sub Last()
'Name of Macro
lr = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows, xlPrevious, False).Row
Range("F1").Formula = "=IF(C1>10,""A"",""B"")"
Range ("F" & (lr))
End Sub
But it's taking the data from N1 instead of N*. Any suggestions? I also googled for a way to soft code the row number based off of the current row, but couldn't find anything. The ROW function didn't do me any good.
The other thing I can think of is to copy it all of the way down to the last row. and then use another macro to clear all of the rows down to the row above it. But, it's getting late. I'll try that in a few days when I get back to my project, but any other ideas until them would be appreciated.