I just learned how to define a Range so I can pass it but I don't know what to call these but field names.
I have a UserForm with several comboboxes and I am searching the sheet to populate each field.
Here is what I've got:
There is a lot more than this but the only things that change are the field names and one variable, the cell's column. These are what I am calling Field Names: LeadEngineer, ImplementationEngineer, PreconfigurationEngineer...
I want to create one loop for all of them but how do I pass the two variables including the Field Names?
I have a UserForm with several comboboxes and I am searching the sheet to populate each field.
Here is what I've got:
Code:
'LEAD ENGINEER
TmpR = SDR 'Get the Starting Date Row
Do While Aws.Cells(TmpR, 1) = DateValue(CurStrDte) And _
Aws.Cells(TmpR, ALEC) <> "" 'Is the Lead Eng not blank and does the Starting Date Row match the Starting Date?
If EngFreeTrghEndDate(Aws, Aws.Cells(TmpR, ALEC), CurStrDte, CurEndDte, TmpR, ALEC) Then
LeadEngineer.AddItem Aws.Cells(TmpR, ALEC) 'YES: Add the Lead Eng to the list.
End If
TmpR = TmpR + 1 ' Advance to the next row
Loop 'CHECK AGAIN
'IMPLEMENTATION ENGINEER
TmpR = SDR 'Get the Starting Date Row
Do While Aws.Cells(TmpR, 1) = DateValue(CurStrDte) And _
Aws.Cells(TmpR, AIMC) <> "" 'Is the Implementation Eng not blank and does the Starting Date Row match the Starting Date?
If EngFreeTrghEndDate(Aws, Aws.Cells(TmpR, AIMC), CurStrDte, CurEndDte, TmpR, AIMC) Then
ImplementationEngineer.AddItem Aws.Cells(TmpR, AIMC) 'YES: Add the Implementation Eng to the list.
End If
TmpR = TmpR + 1 ' Advance to the next row
Loop 'CHECK AGAIN
'PRECONFIG ENGINEER
TmpR = SDR 'Get the Starting Date Row
Do While Aws.Cells(TmpR, 1) = DateValue(CurStrDte) And _
Aws.Cells(TmpR, APCC) <> "" 'Is the Preconfiguration Eng not blank and does the Starting Date Row match the Starting Date?
'Cells(TmpR, APCC).Select 'FOR TESTING ONLY
If EngFreeTrghEndDate(Aws, Aws.Cells(TmpR, APCC), CurStrDte, CurEndDte, TmpR, APCC) Then
PreconfigurationEngineer.AddItem Aws.Cells(TmpR, APCC) 'YES: Add the Preconfiguration Eng to the list.
End If
TmpR = TmpR + 1 ' Advance to the next row
Loop 'CHECK AGAIN
There is a lot more than this but the only things that change are the field names and one variable, the cell's column. These are what I am calling Field Names: LeadEngineer, ImplementationEngineer, PreconfigurationEngineer...
I want to create one loop for all of them but how do I pass the two variables including the Field Names?