Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Putting formula in cells from a loop
Hi - I want to put formulae in cells in my worksheet based on
itterating values. For instance: =sum("A2") =sum("A3") =sum("A4") =sum("A5") The way I thought to do it was from this loop For ii = 1 To 5 Sheets("detail").Range("E" & Trim(Str(ii))).Formula = "=sum(""A""<rim(str(ii)))" Next ii Whatever I try I get #NAME? in the cells on the worksheet. Tried changing quotes, putting ampersands in etc. Any ideas? Thanks Andrew |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Putting formula in cells from a loop
Hi Andrew,
change = "=sum(""A""<rim(str(ii)))" to = "=sum(A" & Trim(Str(ii)) & ")" or simply = "=sum(A" & ii & ")" you don't need the other Trim(Str(ii)) either Regards, Peter T "Andreww" wrote in message oups.com... Hi - I want to put formulae in cells in my worksheet based on itterating values. For instance: =sum("A2") =sum("A3") =sum("A4") =sum("A5") The way I thought to do it was from this loop For ii = 1 To 5 Sheets("detail").Range("E" & Trim(Str(ii))).Formula = "=sum(""A""<rim(str(ii)))" Next ii Whatever I try I get #NAME? in the cells on the worksheet. Tried changing quotes, putting ampersands in etc. Any ideas? Thanks Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
taking numbers in vertical cells putting them in horizontal cells | Excel Worksheet Functions | |||
Getting a filename into VBA and putting it into cells | Excel Discussion (Misc queries) | |||
Putting Multiple Cells into 1 | Excel Discussion (Misc queries) | |||
how can I do this without actually putting into cells | Excel Programming | |||
putting ' in a column of cells | Excel Programming |