View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JN[_3_] JN[_3_] is offline
external usenet poster
 
Posts: 4
Default Adding certain cells

I ended just writing my own...this one seems to work too, atleast for me.

Thanks for your help guys.

Regards,
JN

Sub demo1()

Dim v()
v = Range("a1:b5")

For i = LBound(v, 1) To UBound(v, 1)
For j = i + 1 To UBound(v, 1)
If v(i, 1) = v(j, 1) Then
v(i, 2) = v(i, 2) + v(j, 2)
v(j, 1) = ""
v(j, 2) = ""
End If
Next j
Next i

For i = LBound(v, 1) To UBound(v, 1)
If v(i, 1) < "" Then
Cells(i, 4) = v(i, 1)
Cells(i, 5) = v(i, 2)
End If
Next i

End Sub


"Chip" wrote in message
ups.com...
It is hard for me to do any testing since I dont get an error, but go
into the module, and hit F8, and it will step you through the code, and
maybe you can see whats wrong.