The attached workbook has this sample module:
[VBA]
Sub copyrows()
Dim i As Integer
Dim cRange As String
Dim criteria As String
cString = ""
For i = 13 To 40
criteria = Trim(Cells(i, 8).Value)
If criteria = "C" Or criteria = "D" Then
cString = cString & i & ":" & i & ","
End If
Next
cString = Mid(cString, 1, Len(cString) - 1)
ActiveSheet.Range(cString).Select
Selection.Copy Destination:=ActiveSheet.Range("A50")
Selection.Copy
ActiveSheet.Range("A50").Activate
End Sub
[/VBA]
Prior to running the macro, open up Notepad. When the macro is complete you will see the correct criteria range placed starting in row 50, but activate Notepad and select Paste - seems to include the entire range from the first and last rows selected, not just those with grades C or D.
Is this expected behavior? Stan