I received the following code from this forum:
Sub Test()
Sheets(1).Activate
Sheets(2).Cells.Clear
For N = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(N, 1) <> "" Then
If Left(Cells(N, 3), 3) = "DOB" Then
StudentID = Left(Cells(N, 1), InStr(Cells(N, 1), " ") - 1)
StudentName = Trim(Right(Cells(N, 1), Len(Cells(N, 1)) - Len(StudentID)))
DOB = Right(Cells(N, 3), Len(Cells(N, 3)) - 5)
ElseIf IsNumeric(Cells(N, 1)) Then
TargetRow = Sheets(2).Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets(2).Cells(TargetRow, 1) = StudentID
Sheets(2).Cells(TargetRow, 2) = StudentName
Sheets(2).Cells(TargetRow, 3) = DOB
Sheets(2).Cells(TargetRow, 4) = Cells(N, 3)
Sheets(2).Cells(TargetRow, 5) = Cells(N, 6)
Sheets(2).Cells(TargetRow, 6) = Cells(N, 8)
Sheets(2).Cells(TargetRow, 7) = Cells(N, 9)
Sheets(2).Cells(TargetRow, 8) = Cells(N, 10)
Sheets(2).Cells(TargetRow, 9) = Cells(N, 11)
Sheets(2).Cells(TargetRow, 10) = Cells(N, 12)
Sheets(2).Cells(TargetRow, 11) = Cells(N, 13)
Sheets(2).Cells(TargetRow, 12) = Cells(N, 1)
End If
End If
Next N
End Sub
This code has helped me tremendously. But now I need it for another PDF sheet that is formatted a little different and I cannot seem to get it to work. I have attached a sample of the info with the VBA coding. I have a workbook that has 2500 students formatted this way. I need to be able to put it in a format that I can upload to a database. Thank you.
Bookmarks