Hi,
I'm trying to figure out a code that would insert the text "End" below the last data row of column "D" when the worksheet is activated.
Any help on this would be kindly appreciated.
Thanks in advance.
Hi,
I'm trying to figure out a code that would insert the text "End" below the last data row of column "D" when the worksheet is activated.
Any help on this would be kindly appreciated.
Thanks in advance.
Best Regards,
adamsm
[VBA]Private Sub Worksheet_Activate()
Cells(Rows.Count, 4).End(xlUp)(2) = "End"
End Sub[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thanks for the code mdmackilop. I've changed the code slight bit.
My intention is to add the formula to the column "T" so that each time the worksheet gets activated the formula gets copied to the row below the last data row and sum ups the column from row 17.
But my modification isn't working. How may I do what is being told above?
[VBA]Private Sub Worksheet_Activate()
Cells(Rows.Count, 4).End(xlUp)(2) = "End"
Cells(Rows.Count, 20).End(xlUp)(2) = "=SUBTOTAL(109,T1:T10000)"
End Sub[/VBA]
Any help on this would be kindly appreciated.
Best Regards,
adamsm
I'm not clear on your sub-total function. What is the 109 value? I'd have thought you want something like
[VBA] Cells(Rows.Count, 20).End(xlUp)(2).FormulaR1C1 = "=SUBTOTAL(9,R1C:R[-1]C)"
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thanks for the help. It Worked Fine. And I do really appreciate your help.
Best Regards,
adamsm