To begin, what I ultimately want is to write two custom functions - described below:
Function One - FINDROOM
This function will be sent one argument a course identifier from a different place in the workbook (BUS 3010-001 as an example) and will return the room that this course is scheduled in -- in this case, BUS 3010-001 exists in cell D11 above, so the result should be the cooresponding value from column A, which is 2121
Function Two - FINDTIME
Essentially the same as above. This function will be sent one argument a course identifier from a different place in the workbook (BUS 3010-001 as an example) and will return the time that this course is scheduled -- in this case, BUS 3010-001 exists in cell D11 above, so the result should be the cooresponding value from ROW 2, which is 9:00-9:50
The argument could be any of the courses in C3:U16, or I can certainly use a named range for that.
I've tried working on a custom function called FINDCELL (below) that would just return the resulting cell and then I would extract the row/column identifiers from that to get the information, but am striking out. Any help is certainly greatly appreciated.
Function FINDCELL(Course)
Dim c As Range
For Each c In Worksheets("Rooms").Range("C3:U16")
If c.Value = Course.Value Then
'MsgBox "Found at " & c.Address
FINDCELL = c.Address
CLASSROOM.Value = Worksheets("Rooms").Range(FINDCELL).Value
'MsgBox CLASSROOM.Address
End If
Next c
End Function
Kind Regards,
Paul
Function One - FINDROOM
This function will be sent one argument a course identifier from a different place in the workbook (BUS 3010-001 as an example) and will return the room that this course is scheduled in -- in this case, BUS 3010-001 exists in cell D11 above, so the result should be the cooresponding value from column A, which is 2121
Function Two - FINDTIME
Essentially the same as above. This function will be sent one argument a course identifier from a different place in the workbook (BUS 3010-001 as an example) and will return the time that this course is scheduled -- in this case, BUS 3010-001 exists in cell D11 above, so the result should be the cooresponding value from ROW 2, which is 9:00-9:50
The argument could be any of the courses in C3:U16, or I can certainly use a named range for that.
I've tried working on a custom function called FINDCELL (below) that would just return the resulting cell and then I would extract the row/column identifiers from that to get the information, but am striking out. Any help is certainly greatly appreciated.
Function FINDCELL(Course)
Dim c As Range
For Each c In Worksheets("Rooms").Range("C3:U16")
If c.Value = Course.Value Then
'MsgBox "Found at " & c.Address
FINDCELL = c.Address
CLASSROOM.Value = Worksheets("Rooms").Range(FINDCELL).Value
'MsgBox CLASSROOM.Address
End If
Next c
End Function
Kind Regards,
Paul