ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering Sum formula into a cell (https://www.excelbanter.com/excel-programming/278390-re-entering-sum-formula-into-cell.html)

Bernard Liengme[_3_]

Entering Sum formula into a cell
 
Hi Parker,
Not exactly what you want but it works:

Sub tryme()
Dim myarea As Range
arow = 5
brow = 7
acell = "N" & arow
bcell = "N" & brow

Set myarea = Range(acell, bcell)
For Each mycell In myarea
s = s + mycell
Next
MsgBox s
End Sub

Bernard
"Parker" < wrote in message ...
I am having trouble entering a sum formula from a macro
into a cell. I have defined variables called 'StartRow'
and 'EndRow' and I want to enter a sum formula for column
N from 'StartRow' to 'EndRow' into the active cell. I
don't know how to incopropate the variables into the sum
formula.

Any help would be greatly appreciated.

Thanks in advance!

Parker





All times are GMT +1. The time now is 02:53 AM.

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