Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding 2 cells only if one is not over srctr Excel Discussion (Misc queries) 4 January 13th 09 01:05 PM
Need help w/ adding cells and dividing SUM by number of cells lnbegin Excel Worksheet Functions 4 September 26th 07 04:26 PM
adding more than one value to cells chiliman Excel Worksheet Functions 2 May 18th 06 11:01 PM
I need help adding cells together? jacse Excel Worksheet Functions 4 February 23rd 06 09:23 PM
Adding colour to a range of cells based on one of the cells v... McKenna Excel Discussion (Misc queries) 4 March 11th 05 02:25 PM


All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"