Hello Experts,
I am quite novice to VBA and still learning. So, any help from you would be highly appreciated.
I have an excel sheet (Sheet 4) with Machine codes (Column A) and Service Dates (Column B). Same machine code can be repeated in column A, but always with a unique service date. In my user form there is a combo box called MachineCodeComboBox and a text box called LastServiceDateTextBox.
I want to search for the machine code selected by the user from Sheet 4 and automatically fill the LastServiceDateTextBox with the latest service date of that particular machine code.
I used the below code to search for the machine code but, I couldn't figure out a way to insert the Max Function.
Your expert opinions regarding this questions are highly appreciated.
Thanks a lot in advance
I am quite novice to VBA and still learning. So, any help from you would be highly appreciated.
I have an excel sheet (Sheet 4) with Machine codes (Column A) and Service Dates (Column B). Same machine code can be repeated in column A, but always with a unique service date. In my user form there is a combo box called MachineCodeComboBox and a text box called LastServiceDateTextBox.
I want to search for the machine code selected by the user from Sheet 4 and automatically fill the LastServiceDateTextBox with the latest service date of that particular machine code.
I used the below code to search for the machine code but, I couldn't figure out a way to insert the Max Function.
VBA Code:
Private Sub MachineCodeComboBox_Change()
With Me
.LastServiceDateTextBox = Application.WorksheetFunction.VLookup(Me.MachineCodeComboBox, Sheet4.Range("A:B"), 2, False)
End With
End Sub
Your expert opinions regarding this questions are highly appreciated.
Thanks a lot in advance