ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   To set command for total amount (https://www.excelbanter.com/excel-programming/395567-set-command-total-amount.html)

Jentan

To set command for total amount
 
Hi,

I wish to set a "total" to the Sales column. Then bold the "total"
amount. May I know the command? Please bear in mind that the row is
not fixed for the total amount cell and it depends on the items being
sold. Thank you.


Item Sales
A 10
B 11
C 12


Michael

To set command for total amount
 
From the Data menu
Select Subtotals and follow the prompts.

This will generate a subtotal and a grand total in bold letters for you
automatically without the need of any coding

Michael Arch.

"Jentan" wrote:

Hi,

I wish to set a "total" to the Sales column. Then bold the "total"
amount. May I know the command? Please bear in mind that the row is
not fixed for the total amount cell and it depends on the items being
sold. Thank you.


Item Sales
A 10
B 11
C 12



Dan R.

To set command for total amount
 
Michael's right, but if you must:


Sub test()

Set iEnd = Cells(Rows.Count, 2).End(xlUp)

With iEnd.Offset(1, 0)
.Formula = "=SUM($B$2:" & iEnd.Address & ")"
.Font.Bold = True
End With

End Sub


--
Dan



All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com