Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA: Using a range in a formula
Is there a way to use a range that i've declared previously in the same macro?
In my example, row1 and row2 are the ranges I want to use (work_items_database was not declared in the macro). I want to use these ranges in a dsum formula to go from the position of row1 to the position of row2, but this does not work: Sheets("hours available").Cells(ActiveCell.Row + 1, ActiveCell.Column).FormulaR1C1 = "=dsum(work_items_database,""work effort (hours)""," & row1.Address & ":" & row2.Address & ")" Again, row1 and row2 are ranges that I have already declared and assigned locations to. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using a range in a formula
Try
Sheets("hours available").Cells(ActiveCell.Row + 1, ActiveCell.Column).Formula = "=dsum(work_items_database,""work effort (hours)""," & row1.Address & ":" & row2.Address & ")" -- __________________________________ HTH Bob "Jayne22" wrote in message ... Is there a way to use a range that i've declared previously in the same macro? In my example, row1 and row2 are the ranges I want to use (work_items_database was not declared in the macro). I want to use these ranges in a dsum formula to go from the position of row1 to the position of row2, but this does not work: Sheets("hours available").Cells(ActiveCell.Row + 1, ActiveCell.Column).FormulaR1C1 = "=dsum(work_items_database,""work effort (hours)""," & row1.Address & ":" & row2.Address & ")" Again, row1 and row2 are ranges that I have already declared and assigned locations to. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
conditional formula: sum a range if text present in another range | Excel Discussion (Misc queries) | |||
formula to sort a range so that it matches the exact rows of a column that is outside that range? | Excel Discussion (Misc queries) | |||
Macro to input formula in range based on another range | Excel Programming | |||
Range.Formula and Range question using Excel Automation | Excel Programming |