View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default select distinct row

Here is some code

Dim iLastRow As Long
Application.ScreenUpdating = False
With Worksheets("Sheet1")
iLastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1").EntireRow.Insert
.Columns("A:A").AutoFilter Field:=1, Criteria1:="Andy"
.Range("A2:A" & iLastRow +
1).SpecialCells(xlCellTypeVisible).EntireRow.Copy _
Destination:=Worksheets("Sheet2").Range("A1")
.Range("A1").EntireRow.Delete
End With
Application.ScreenUpdating = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"weejeow " wrote in message
...
Hie guys,

i need another guide.

how can i select distinct row and transfer to another sheets?
below are the example in sheet 1:

Name | Payment | Date
-----------------------------
John | $50 | 20/04/04
Andy | $28 | 20/04/04
Andy | $10 | 21/04/04


so for sheet 2 and 3, how do i come about macro/function to
automatically create the sheet and transfer the row distinctly by
"Name"?

eg:
Sheet 2

Name | Payment | Date
-----------------------------
John | $50 | 20/04/04


eg:
Sheet 3

Name | Payment | Date
-----------------------------
Andy | $28 | 20/04/04
Andy | $10 | 21/04/04

Thanks in advance!

Cheers


---
Message posted from http://www.ExcelForum.com/