![]() |
Entering Sum formula into a cell
Parker
Here's one way to do it: Sub Test() 'Leo Heuser 29 Sept. 2003 Dim DataColumn As String Dim DestCell As Range Dim EndRow As Long Dim StartRow As Long StartRow = 1 EndRow = 6 DataColumn = "A" Set DestCell = Range("B7") DestCell.Formula = "=SUM(" & _ Range(DataColumn & StartRow).Address & _ ":" & Range(DataColumn & EndRow).Address & ")" End Sub -- Best Regards Leo Heuser MVP Excel Followup to newsgroup only please. "Parker" skrev i en meddelelse ... 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 03:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com