summing data in several columns

D

david72

Hi

I have several sheets that contain the following data: eg column a has
brk and column b has a town and column c has a value. Is there any way
I can sum the total for column a and column b in a another sheet

Thanks for any help/
 
B

bgeier

How do you mean sum them in another sheet?
Do you want column "A" totaled and column "B" totaled or do you want
the total of column "A" PLUS total of Column "B"?
 
D

david72

If column a and column b are the same. I would like to sum the total of
column c.

Thanks
 
B

bgeier

I apologize, I missed the last clause of the first phrase in your post.
(I claim temporary stupidity)


Code:
--------------------
Sub TotalC()
Dim intRowCounter As Integer

intRowCounter = 1

Do Until Cells(intRowCounter, 1) = ""
If ThisWorkbook.Worksheets("Sheet1").Cells(intRowCounter, 1) = ThisWorkbook.Worksheets("Sheet1").Cells(intRowCounter, 2) Then _
ThisWorkbook.Worksheets("Sheet2").Cells(1, 1) = ThisWorkbook.Worksheets("Sheet2").Cells(1, 1) + ThisWorkbook.Worksheets("Sheet1").Cells(1, 3)
intRowCounter = intRowCounter + 1
Loop
End Sub
 
Top