Formerly Best Training
© 2024 STL. All Rights Reserved.
All prices offered for business users and exclude VAT. E&OE
2nd Floor, CA House, 1 Northey Street, Limehouse Basin, London, E14 8BT. United Kingdom
Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » AutoSum
Resolved · Medium Priority · Version 2007
Ross has attended:
Excel VBA Intro Intermediate course
Hi
After running a macro i want to put a sum at the bottom but the problem is that the area could change each time
the current formula is
range("D7").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(R[-12]C:R[-1]C)"
This will only sum 12 Rows. The amount of row will vary
how can tell how many rows it needs to Sum.
Hi Ross, have a look in our commented code for how we used currentregion.rows.count and then use that to cope with your fluctuating numbers of rows.
Hope this helps,
Anthony
Fri 2 Mar 2012: Automatically marked as resolved.
|
Excel tip:How to select certain data in an Excel 2010 workbookIf you want to select the correct data set in a page full of data, the most accurate and efficient way of doing this is to use the ''Shift and Click'' technique. |
We'll call during UK business hours
Server loaded in 0.07 secs.