Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Can anyone tell me how to create a Macro that performs the SUM function in a selected worksheet?
Any/all assistance is greatly appreciated. Thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=SUM(A32:A44)
Put this in the space where you want the total to be. This example sums everything in A32 to A44. Use any range you need. "frankjh19701" wrote in message ... Can anyone tell me how to create a Macro that performs the SUM function in a selected worksheet? Any/all assistance is greatly appreciated. Thank you -- frankjh19701 |
#3
![]() |
|||
|
|||
![]()
Thank you for the reply.
I was looking to use the SUM function inside a Macro and have the results populate into a different sheet within the same workbook. For example: Macro to fins sum of Column M in Sheet named Bass-1 and return the result in a sheet titled "Totals". Please let me know your thoughts. Thank you Quote:
|
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Frank,
Am Wed, 6 Nov 2013 17:54:25 +0000 schrieb frankjh19701: Macro to fins sum of Column M in Sheet named Bass-1 and return the result in a sheet titled "Totals". try: With Sheets("Bass-1") LRow = .Cells(Rows.Count, "M").End(xlUp).Row Sheets("Totals").Range("A2") = _ WorksheetFunction.Sum(.Range("M:M")) End With or: Sheets("Totals").Range("A1").Formula = _ "=Sum('Bass-1'!" & Range("M:M").Address & ")" Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#5
![]() |
|||
|
|||
![]()
Thank you Claus.
How would I start the Macro in VBA? What's the correct wording? |
#6
![]() |
|||
|
|||
![]()
I've tried it a number of ways and cannot get it to work.
|
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Frank,
Am Wed, 6 Nov 2013 20:08:09 +0000 schrieb frankjh19701: How would I start the Macro in VBA? e.g. you have this code in a standard module: Sub Test2() Dim LRow As Long With Sheets("Bass-1") LRow = .Cells(Rows.Count, "M").End(xlUp).Row Sheets("Totals").Range("A2") = _ WorksheetFunction.Sum(.Range("M:M")) End With End Sub so you can run the macro from the sheet = Macros = Test2 = Run Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#8
![]() |
|||
|
|||
![]()
Thank you, Claus.
That worked! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MACRO FUNCTION conflict with other macro's | Excel Discussion (Misc queries) | |||
Using A Function in a Macro | Excel Worksheet Functions | |||
Not sure what function, macro, etc to use | Excel Worksheet Functions | |||
Sub Macro vrs Function Macro Auto Start | Excel Discussion (Misc queries) | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming |