Hi,
I have code that loops through several columns and I am trying to add a few rows. For example, I want cell B13 to sum B14-B16; C13 to sum C14-C16, and so on. The code below sums everything. It adds B14, B15, B16, C14, C15, C16 and repeats the same number in row 13. In theory I should have different numbers is B13 and C13. Please help!!
For cnt = 1 To x + 1 Cells(13, cnt + 1).Formula = "=SUM(14:16)" Next cnt
Last edited by miam; 07-25-2011 at 02:37 AM.
Hi and welcome to the forum.
No need for a loop:
Range("A13").Resize(, x + 1).FormulaR1C1 = "=SUM(R[1]C:R[3]C)"
Thank you Colin!
Hi Colin, may I ask a follow up question. The code you suggested worked beautifully for my intended purpose so thanks again. I need to repeat the equation again, but this time the variables I am using are in sequential cells, but the output skips a cell. When I use the code below it skips reading the input because the output skips a cell as well.
For example, I want to display the results in C57, E57, G57, etc. but the data I'm pulling from is in column B,C,D. I want C57 to use information found in column B; E57 to use info in column C, and so on. Can you please help?ActiveCell.Resize(, x + 1).FormulaR1C1 = _ "=IF((Workload_Drivers!R[-47]C[-1]*Workload_Drivers!R[-43]C[-1]/7)>Workload_Drivers!R[-37]C[-1],((Workload_Drivers!R[-47]C[-1]*Workload_Drivers!R[-43]C[-1])-Workload_Drivers!R[-37]C[-1])/Workload_Drivers!R[-36]C[-1],0)"
Lastly, if its not too much trouble. Could you help me with the syntax for a related If statement.
Last question, I promise. I truly appreciate your help!!If (ActiveCell.Resize(, x + 1).FormulaR1C1 = "=IF(Workload_Drivers!R[-2]C=""No EOC activation"") Then![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks