This is my code, it works fine for 1-9 but 10 and 11 return results for 1 and 12 returns results for 1 and some of 2. I would appriciate any tips.
[VBA]
Sub CompileM10()
'Selects cells containing "10" in column g
Sheets("Master").Select
Range("A1").Select
Dim Col As Integer
Dim CEL As Range
Dim SelRange As Range
For Col = 7 To 7 'columns g through g
For Each CEL In Range(Cells(1, Col), Cells(65536, Col).End(xlUp))
If CEL Like "[10]" Then
If SelRange Is Nothing Then
Set SelRange = CEL
Else
Set SelRange = Union(SelRange, CEL)
End If
End If
Next CEL
Next Col
SelRange.Select
Range(Selection, Selection.End(xlToLeft)).Select
ActiveWindow.SmallScroll Down:=9
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("M10").Select
Range("A1").Select
ActiveSheet.Paste
Selection.sort Key1:=Range("G1"), Order1:=xlAscending, Key2:=Range("E1") _
, Order2:=xlAscending, Key3:=Range("F1"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
End Sub
[/VBA]
Edit Lucas: Adonaioc, when posting code...select the code and hit the vba button.