I have some code which copies formulas from T13 down to the last used row in T13 whenever the file is saved. However I have a problem where i put something in say rows 13 to 20 but then delete rows 15-20 at some point, yet excel doesnt update the last used rows properly so when the macro in Workbook_BeforeSave runs the below code, it still thinks rows 13-20 are used and it copies the formulas down to row 20 even when 15-20 are now blank because I have deleted the ENTIRE rows (and some below that just to be sure).
I have had this problem before where excel seemingly doesnt update the last used rows until you actually exit the file and open it again so I am wondering if there is some command to force excel to update what it thinks is the last used row, so that i can get that value updated just before the macro runs the copy down formulas code, my code for reference is
Range("T13").Copy
Range("T13:T" & ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
any ideas??
Bookmarks