Greetings! I am trying to find the best way to utilize my UserForm to find a member, and edit their information (within the found row) based on the values that changed.
---------------------------------------------------------------------------------------------------------------------------
The lookup (for first and last name) function is:
'Col1= First Name
'Col2= Last Name
Function Teach_lookup(Table_Range As Range, Return_Col As Long, Col1_Fnd, Col2_Fnd)
Dim rCheck As Range, bFound As Boolean, lLoop As Long
On Error Resume Next
Set rCheck = Table_Range.Columns(1).Cells(1, 1)
With WorksheetFunction
For lLoop = 1 To .CountIf(Table_Range.Columns(1), Col1_Fnd)
Set rCheck = Table_Range.Columns(1).Find(Col1_Fnd, rCheck, xlValues, xlWhole, xlNext, xlRows, False)
If UCase(rCheck(1, 2)) = UCase(Col2_Fnd) Then
bFound = True
Exit For
End If
Next lLoop
End With
If bFound = True Then
Teach_lookup = rCheck(1, Return_Col)
Else
Teach_lookup = "#N/A"
End If
End Function
---------------------------------------------------------------------------------------------------------------------------
The UserForm pulls from this function to fill the TextBoxes in the UserForm:-
For Instance for bday(TextBox)-
bday = Teach_lookup(Sheets("Master").Range("A:K"), 8, tname.Value, teach_ln)
Here's my question. If I want to edit the teacher's birthdate, how do I change the cell from where the information originated?
Thank you for your time!!
---------------------------------------------------------------------------------------------------------------------------
The lookup (for first and last name) function is:
'Col1= First Name
'Col2= Last Name
Function Teach_lookup(Table_Range As Range, Return_Col As Long, Col1_Fnd, Col2_Fnd)
Dim rCheck As Range, bFound As Boolean, lLoop As Long
On Error Resume Next
Set rCheck = Table_Range.Columns(1).Cells(1, 1)
With WorksheetFunction
For lLoop = 1 To .CountIf(Table_Range.Columns(1), Col1_Fnd)
Set rCheck = Table_Range.Columns(1).Find(Col1_Fnd, rCheck, xlValues, xlWhole, xlNext, xlRows, False)
If UCase(rCheck(1, 2)) = UCase(Col2_Fnd) Then
bFound = True
Exit For
End If
Next lLoop
End With
If bFound = True Then
Teach_lookup = rCheck(1, Return_Col)
Else
Teach_lookup = "#N/A"
End If
End Function
---------------------------------------------------------------------------------------------------------------------------
The UserForm pulls from this function to fill the TextBoxes in the UserForm:-
For Instance for bday(TextBox)-
bday = Teach_lookup(Sheets("Master").Range("A:K"), 8, tname.Value, teach_ln)
Here's my question. If I want to edit the teacher's birthdate, how do I change the cell from where the information originated?
Thank you for your time!!