![]() |
Getting value of an Autosum
I have a small piece of code in my program that looks like this:
Range("J1").Select 'Make Cell J1 Active ActiveCell.FormulaR1C1 = "=SUM(R[4]C:R[504]C)" 'Calc. sum for Cells J5 to J505 However I now need to put the result of the Autosum into a variable. I have used: Range("J1).Select Variable = ActiveCell and Variable = ActiveCell.FormulaR1C1 = "=SUM(R[4]C:R[504]C)" But neither of these seem to work as the variable is still empty. Can anyone point me in the right direction? Thanks Neil |
Getting value of an Autosum
Dim dblSum as Double
dblSum = Application.WorksheetFunction.Sum( Range("J5:J505")) msgbox format(dblSum,"#0.00") -- regards, Tom Ogilvy "Neil" wrote in message ... I have a small piece of code in my program that looks like this: Range("J1").Select 'Make Cell J1 Active ActiveCell.FormulaR1C1 = "=SUM(R[4]C:R[504]C)" 'Calc. sum for Cells J5 to J505 However I now need to put the result of the Autosum into a variable. I have used: Range("J1).Select Variable = ActiveCell and Variable = ActiveCell.FormulaR1C1 = "=SUM(R[4]C:R[504]C)" But neither of these seem to work as the variable is still empty. Can anyone point me in the right direction? Thanks Neil |
All times are GMT +1. The time now is 08:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com