Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"=sum(variable:variable2)"
I would like to put this formula into a specific cell. Here is my code:
for Counter 1 to 20 Cells((OneWkRow + 8), Counter).Value = "=Sum(c1_right_1 : c_right_1)" Next Counter Why is this not working? Can I not use variables in this instance? How can I make this work? Thanks!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"=sum(variable:variable2)"
Everything between " and " is treated as a string. Try something like
Cells((OneWkRow + 8), Counter).Value = _ "=Sum(" & c1_right_1 &":" & c_right_1 & ")" HTH Rowan "KyWilde" wrote: I would like to put this formula into a specific cell. Here is my code: for Counter 1 to 20 Cells((OneWkRow + 8), Counter).Value = "=Sum(c1_right_1 : c_right_1)" Next Counter Why is this not working? Can I not use variables in this instance? How can I make this work? Thanks!!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
"=sum(variable:variable2)"
You have 20 columns starting at A.
You have 7 days data - in my example these are rows 5 to 11 , so OneWkStart is set to row 5 In the next row, row 12, you want to add the values in the columns for the week? Try this as an alternative Sub Demo() Dim OneWkRow As Long OneWkRow = 5 With Range(Cells(OneWkRow + 7, 1), Cells(OneWkRow + 7, 20)) .FormulaR1C1 = "=Sum(R[-8]C:R[-1]C)" End With End Sub "KyWilde" wrote: I would like to put this formula into a specific cell. Here is my code: for Counter 1 to 20 Cells((OneWkRow + 8), Counter).Value = "=Sum(c1_right_1 : c_right_1)" Next Counter Why is this not working? Can I not use variables in this instance? How can I make this work? Thanks!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
"Type mismatch" when I try to fill an Array variable with "+" | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
reading variable "from" and "to" ZIP codes | Excel Programming |