![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Hengelo
Posts: 79
|
Hello,
I want to total different columns. But I can't figure out the right code. For b = 1 To 15 Cells(b, 16).FormulaR1C1 = "=SUM(C & b)" Next This doesn't work. Who can help me!? Martin |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Quote:
Cells(b, 16).FormulaR1C1 = "=SUM(C" & b But, why use SUM ? that's only one cell, you could just use: Cells(b, 16).FormulaR1C1 = "=C" & b |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Location: Belgium
Posts: 24
|
Hello Martin,
Answering you would be easy if you could explain better what you exactly want. Do you want to sum the columns from 1 to 15 in the 16th column in row i? If yes, check the two codes below: For b=1 to 15 cells(i,16)=cells(i,16)+cells(i,b) next b OR Cells(i, 16).FormulaR1C1 = "=SUM(C1:C15)" I hope I could help you, Pierre [ This Message was edited by: paludgnp on 2002-02-19 06:17 ] |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Quote:
Cells(b, 16).FormulaR1C1 = "=SUM(C" & b & ")" I still don't understand why you need SUM, but this should work. |
|
|
|
|
|
|
#5 | |
|
Board Regular
Join Date: Feb 2002
Location: Hengelo
Posts: 79
|
Quote:
I have say three columns(A, B, C) there is a serie of numbers in each column. I want the total of each column in cells D1, D2 and D3. Sub Test() For x = 1 To 3 Cells(x, 4).FormulaR1C1 = "=SUM(C" & x & ")" Next End Sub The macro above can't do the trick. WHY?!?! Best regards, Martin
__________________
Best regards, Martin J.A. Maatman Oonk |
|
|
|
|
|
|
#6 | |
|
Board Regular
Join Date: Feb 2002
Location: Hengelo
Posts: 79
|
Quote:
In cell D1 stands the total of column1 = column A In cell D2 stands the total of column2 = column B In cell D3 stands the total of column3 = column C
__________________
Best regards, Martin J.A. Maatman Oonk |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|