LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I Sum variables

Hi All,
This is only a small part of the spreadsheet
I have a component Name in Column C2:C20 and quantity in Column D2:D20.
ColumnC can contain many components of the same name.
I have managed with VBA code ( Thanks to Colo's Excel Junk Room) to put all
unique component names in ColumnC starting at C22.
What I can't seem to be able to do is sum the unique totals from D2:D20 for
the unique names for Column D starting at D22
The code below works for individual Names. There are a possible 150 part
names so I reckon that there would be a way with a For... Each... routine or
a loop. But, I can't get either of them to produce the correct result.
Also there is no way of knowing what part name will be at what address
Can anyone help?
Dim cn
Dim tally
Dim Qty
For Each cn In myRange3
If cn = "6T2" Then
Qty = cn.Offset(0, 1)
tally = tally + a3
End If
Next
Range("D22").Value = tally


Thanks
Richard


 
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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Too Many Variables Heliocracy Excel Worksheet Functions 6 April 6th 07 07:02 PM
Using variables . . . Wayne Knazek Excel Discussion (Misc queries) 2 July 6th 06 05:01 PM
What are my variables ... ? DJB[_5_] Excel Programming 4 July 4th 05 03:51 PM
Variables richie Excel Programming 1 October 16th 03 06:44 PM


All times are GMT +1. The time now is 12:08 AM.

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"