I am in need of some help. I work at a college and I have a workbook where I maintain enrollment data. Within the workbooks I have a sheet for each school year. On each sheet there is data for each term (fall, spring, summer) and an unduplicated count.
Here is how the data is set up column wise.
Fall - Columns A-G
Spring - Columns I-O
Summer - Columns Q-W
Unduplicated - Columns Y-AD
I am needing to take each student in the Unduplicated section and see which terms they attended. If they attended a specific term, I need to grab a piece of data from that term and put it in over in the undulicated area. The only way I could think to do this is with three separate searches. This is probably grossly inefficient and so far it has not worked at all. I have posted below the code I am currently using. Again this code is not workin at all.
For lRow = 2 To wsMajors.Cells(Rows.Count, 25).End(xlUp).Row Step 1
sSSN = wsMajors.Cells(lRow, 25).Value
'Search in Fall Term
Set rMajors = wsMajors.Cells.Find(what:=sSSN, After:=wsMajors.Cells(1, 2), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not rMajors Is Nothing Then
wsMajors.Cells(lRow, 28).Value = wsMajors.Cells(rMajors.Row, 5)
Else
wsMajors.Cells(lRow, 28).Value = ""
End If
Set rMajors = Nothing
'Search in Spring Term
Set rMajors = wsMajors.Cells.Find(what:=sSSN, After:=wsMajors.Cells(1, 10), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not rMajors Is Nothing Then
wsMajors.Cells(lRow, 29).Value = wsMajors.Cells(rMajors.Row, 13)
Else
wsMajors.Cells(lRow, 28).Value = ""
End If
Set rMajors = Nothing
'Search in Summer Term
Set rMajors = wsMajors.Cells.Find(what:=sSSN, After:=wsMajors.Cells(1, 18), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not rMajors Is Nothing Then
wsMajors.Cells(lRow, 30).Value = wsMajors.Cells(rMajors.Row, 21)
Else
wsMajors.Cells(lRow, 28).Value = ""
End If
Set rMajors = Nothing
Next lRow
Any suggestions on how to do this would certianly be appreciated.
Bookmarks