FranktheBank
Member
Hello all,
Many 'Thanks' in advance.
I'm trying to write some script that if the user enters an 'unused' position number in the Userform, certain actions will occur (right now I just want it to say "Caution: This is an unused Position number The information you provide will be the default for this position from this point forward."
I'm getting the message: Compile Error: Argument no optional and it has a blue highlight over the '.VLookup'
I've never used the IfError function before
Many 'Thanks' in advance.
I'm trying to write some script that if the user enters an 'unused' position number in the Userform, certain actions will occur (right now I just want it to say "Caution: This is an unused Position number The information you provide will be the default for this position from this point forward."
I'm getting the message: Compile Error: Argument no optional and it has a blue highlight over the '.VLookup'
Code:
Private Sub New_Position_Number_AfterUpdate()
New_Position_Number.Value = Format(New_Position_Number.Value, "00000000")
WorksheetFunction.IfError(WorksheetFunction.VLookup(CDbl(New_Position_Number.Value), Sheets("Sheet4").Range("a2:h250")), 1, False, "Caution: This is an unused Position number The information you provide will be the default for this position from this point forward.") = ""
Position_Title.Value = WorksheetFunction.VLookup(CDbl(New_Position_Number.Value), Sheets("Sheet4").Range("a2:h250"), 2, False)
Pos_Class.Value = WorksheetFunction.VLookup(CDbl(New_Position_Number.Value), Sheets("Sheet4").Range("a2:h250"), 3, False)
End Sub
I've never used the IfError function before