ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extracting records from a list (https://www.excelbanter.com/excel-programming/438614-extracting-records-list.html)

HUGO

Extracting records from a list
 
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.

joel[_576_]

Extracting records from a list
 

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 With
--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=171620

Microsoft Office Help



All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com