Hi Christine,
You don't really need VBA to pull this off (although you can).
Non-VBA Way:
1.) Data>Import External Data>Import Data>
2.) Change "Files Of Type" Drop down to "Excel Files (*.xls)"
3.) Select the workbook you are already in.
4.) Click Open
5.) You will be presented with a prompt for "Select Table", select the correct worksheet name (Ex:Sheet1$) and click OK.
6.) Click "New Worksheet"
7.) Click "Edit Query"
8.) (Assume your column with "a"s in it is named "Flag".)
9.) Change "Command Type" to SQL.
10.) Paste the Following:
Select * From [Sheet1$] Where [Flag] = 'a'
Here is the same way with VBA:
[vba]Public Sub Example()
Const strConnection_c As String = _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xxx; " & _
"Extended Properties=""HDR=YES;"";Jet OLEDB:System database="""";" & _
"Jet OLEDB:Registry Path="""";Jet OLEDBatabase Password="""";" & _
"Jet OLEDB:Engine Type=35"
Dim ws As Excel.Worksheet
Set ws = ThisWorkbook.Worksheets.Add
ws.Name = "Just A"
With ws.QueryTables.Add(Replace(strConnection_c, "xxx", ThisWorkbook.FullName), _
ws.Cells(1, 1), "Select * From [Sheet1$] Where [Flag] = 'a'")
.Refresh BackgroundQuery:=False
End With
End Sub[/vba]