View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Filtering and Separating Data

assume your data as shown is on a sheet named DATA and you want your new
table on Sheet2.

Sub AAAA()
With Sheets("Data")
.Rows(1).Insert
.Range("A1").Value = "Name"
.Range("B1").Value = "Status"
.Range("D1").Value = "Status"
.Range("D2").Value = "MET"
End With
With Sheets("Sheet2")
.Range("A1").Value = "Name"
.Range("B1").Value = "Name"
End With

Sheets("Data").Range("A1").CurrentRegion.Resize(, 2).AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Data").Range("D1:D2"), _
CopyToRange:=Sheets("Sheet2").Range("A1"), _
Unique:=False

Sheets("Data").Range("D2").Value = "<MET"
Sheets("Data").Range("A1").CurrentRegion.Resize(, 2).AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Data").Range("D1:D2"), _
CopyToRange:=Sheets("Sheet2").Range("B1"), _
Unique:=False
With Sheets("Sheet2")
.Range("A1").Value = "GOOD"
.Range("B1").Value = "BAD"
End With
Worksheets("Data").Rows(1).Delete
End Sub


--
Regards,
Tom Ogilvy

"grin2000 " wrote in message
...
I have the following table:

A B
1 Adam -50
2 James MET
3 Hank -800
4 Will -300
5 Bill MET
6 Ken -98
7 Frank -80
8 Kerry -220
9 Ken -400
10 Bond MET


There are these 10 guys which either met their payments or still owe a
certain amount. The status column B can either have a negative number
in it or the word MET. So all guys could either have met the deadline
to pay or still owe. I wanted to have shown on another page in 2 colums
shown like this:

A B
1 GOOD BAD
2 James Adam
3 Bill Hank
4 Bond WIll
5 Ken
6 Frank
7 Kerry
8 Ken
9
10


I just don't know what macro or something else would work that can look
at the first table and then list the people in the right columns, Good
and Bad on the first page.

Thanks, I appreciate the help.


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