filter result box

M

mike allen

i have a large spreadsheet and i use data filter to select top few from
various columns. i would like to have a box pop up showing 2 or more
columns of these columns:
Sub Macro3()
Selection.AutoFilter Field:=9, Criteria1:="3", Operator:=xlTop10Items
end sub

would like this to run, then show in a msgbox-like presentation showing:
john 99%
will 96%
david 91%
w/ "OK" button when finished viewing, so i can continue w/ code,
like taking off filter.

the names are in columnA, while the scores (which are the top 3 in the
class) are in columnI (9th column). is this possible? thanks, mike allen
 
M

MSP77079

Of course it's possible!


Sub Macro3()
FirstRow = Selection.Row
LastRow = Selection.End(xlDown).Row
Selection.AutoFilter Field:=9, Criteria1:="3", Operator:=xlTop10Items
myMessage = ""
For i = FirstRow To LastRow
If Cells(i, "name the column that has names").EntireRow.Hidden = Fals
Then
myMessage = myMessage & Cells(i, "name column") _
& " - " & Cells(i, "percent column") _
& Chr(10) 'Chr(10) is line feed
End If
Next i
MsgBox myMessage
End Su
 
Top