Hi,
Try the following:
Public Sub CopyRows()
Dim lRow As Long
Dim lLastRow As Long
Dim lTargetRow As Long
Dim wksData As Excel.Worksheet ' data sheet
Dim wksTarget As Excel.Worksheet ' target sheet
Const iCOL As Integer = 6 ' column F
Const lFIRST_ROW As Integer = 2 ' first data row (change as appropriate)
Set wksData = ThisWorkbook.Sheets(1) ' change as appropriate
Set wksTarget = ThisWorkbook.Sheets.Add
With wksData
' get the last used row
lLastRow = .Cells(.Rows.Count, iCOL).End(xlUp).Row
' loop through used rows
lTargetRow = 1
For lRow = lFIRST_ROW To lLastRow
' check whether the cell value starts with "a" and paste to the
' target row on the target sheet if so
If Left$(Trim$(.Cells(lRow, iCOL)), 1) = "a" Then
.Rows(lRow).EntireRow.Copy
wksTarget.Cells(lTargetRow, 1).PasteSpecial , Paste:=xlAll
lTargetRow = lTargetRow + 1
End If
Next
End With
Set wksData = Nothing
Set wksTarget = Nothing
End Sub
Thanks,
Dom
Bookmarks