Extracting records from a list

H

Hugo

I would like to extract records from a long list of 500 rows.
The list is already sorted by the first column. There is a maximum of four
possible values for the first column with multiple values for the other ones.
I would like to create four different lists, each with only one of the
possible value in its first column by extracting them from the "master" list.
Any help or pointer will be gratefully appreciated.
 
J

joel

Here is some very simple generic code


Code
-------------------
Set SourceSht = Sheets("Sheet1")
Set DestSht = Sheets("Sheet1")

With SourceSht
LastRow = .Range("A" & RowCount).End(xlUp).Row
StartRow = 1
For RowCount = StartRow To LastRow
If .Range("A" & RowCount) <> .Range("A" & (RowCount)) Then
Set CopyRange = .Rows(StartRow & ":" & RowCount).Copy
Set DestRange = .Rows(1)
CopyRange.Copy Destination:=DestRange
StartRow = RowCount + 1
End If
Next RowCount
End Wit
 

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