View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vacuum Sealed Vacuum Sealed is offline
external usenet poster
 
Posts: 259
Default Finding, grouping, then copy/paste to new sheet

Hi All

As the subject states, I need to copy cName.Values from one sheet to
another, although, I don't need every instance of the cName.Values, just one
of each.

I then need it to go back again, find the Count of each cName, and repeat it
to find the Sum of each cName.

Dim SS As Sheet 'Source Sheet
Dim DS As Sheet 'Destination Sheet
Dim myRng As Range
Dim cName As String
Dim Sum_myCrng As Range

Set myRng = Range("F2:F200")
Set Sum_myCrng = Range("R2:R200")

eg

cName: MINS:
ABC Co. 50
XYZ Corp 250
ABC Co. 45
ABC Co. 100

So, for each cName in myRng I need to copy the name into
Sheets("Data").Column ("A").

I use the following to find the first empty cell along Column ("A")...

Columns("A").Find("", Cells(Rows.Count, "A"), xlValues, _
xlWhole, , xlNext).Select

Paste the cName from SS and repeat till one instance of all cNames has been
copied across to DS.

Next

Back to SS, count how many instances of each cName there are in myRng, then
go back to DS paste the Count.Value for each cName in Column ("A").Offset(0,
2) 'which is column C.

Next

Back to SS, Sum each cName there are in Sum_myCrng, then go back to DS paste
the Sum.Value for each cName in Column ("A").Offset(0, 1) 'which is column
B.