Hi
this macro might work
to explain:
it finds the last block of characters in the title cell (ie cell A53), which is the week number
for each cell in the range "teachers" (the range in shee Utility with the names in), it:
- finds the column with that name in row 2 of the sheet with the name name as the week number
- finds the value row in 361 of the column to the right of that column
- copies this value into the cell 3 columns to the right of the teacher's name in sheet "utility"
Sub HoursFind()
Dim Teachers As Range, TTell As Range, TName As String, WeekNum As Variant, arrNos As Variant, NameCol As Long, SearchRange As Range
'find week number
arrNos = Split(Sheets("Utility").Range("A53").Value, " ")
WeekNum = Trim(arrNos(UBound(arrNos)))
Set SearchRange = Sheets(WeekNum).Rows(2)
Set Teachers = Sheets("Utility").Range("C55:c63")
For Each Tcell In Teachers.Cells
TName = Tcell.Value
NameCol = Application.WorksheetFunction.Match(TName, SearchRange, 0)
Tcell.Offset(0, 3).Value = Sheets(WeekNum).Rows(361).Columns(NameCol).Offset(0, 1).Value
Next Tcell
End Sub
Bookmarks