adding columns

M

Masterzan

I have a sheet that I basically need to summarise - however it has various
columns that need to be summarised eg.

Checker. cases. overs.shorts
amy .100.1.0
peter.25.2.3
jack.56.4.1
amy.10.3.6

I need to summarise to show:

Checker. cases. overs.shorts
amy.110.4.6

Thanks

Claire
 
B

Bob Phillips

Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow

If Application.CountIf(.Columns("A"), .Cells(i, "A").Value) > 1
Then

For j = 2 To 4

.Cells(i, j).Value = Application.SumIf(.Columns("A"),
..Cells(i, "A").Value, .Columns(j))
Next j
End If
Next i

For i = LastRow To 1 Step -1

If Application.CountIf(.Columns("A"), .Cells(i, "A").Value) > 1
Then

.Rows(i).Delete
End If
Next i
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top