Specifically a sub that uses the values in a column labeled "Class" (the heading is 6 rows down from the top, and will move as additional columns are added to the sheet) to copy all records for students in Class 001(one of the two possible entries under the class heading) to a new worksheet labeled “Class 001”, and all records for students in Class 002 (the other possible entry under the "Class" heading) to a new worksheet labeled “Class 002" The spreadsheet is a list of names and assignment grades that display both meeting times for the same college class. Also, the new worksheets should appear as the second and third worksheets on the switch worksheet tab.
I realize I will need a loop to do this, and will post my starting code below, but it only searches for one criteria. I am unsure how to make it search separately for 2 criteria in the same column and then paste each respective result to separate sheets.
Any help would be much appreciated.
Thanks.
I realize I will need a loop to do this, and will post my starting code below, but it only searches for one criteria. I am unsure how to make it search separately for 2 criteria in the same column and then paste each respective result to separate sheets.
Any help would be much appreciated.
Thanks.
Code:
Sub BreakBySection()
'Add Worksheets
Sheets.Add.Name = "Class002"
Sheets.Add.Name = "Class001"
x = 6
'Start Loop
Do While Cells(x, 1) <> ""
If Cells(x, 1) = "0.0" Then
'Copy row with "0.0"
Worksheets("Grades").Rows(x).Copy
'select data to class 001 Worksheet
Worksheets(SClass001").Activate
'first empty row
erow = Section001.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'paste data
ActiveSheet.Paste Destination:=Worksheets("Class001").Rows(erow)
End If
Worksheets("Grades").Activate
x = x + 1
Loop
End Sub