Software: MS 365 32-Bit (only because Active X and other tools are not available in 64-Bit version which has caused errors in formulas and other VBA coding)
I am hoping that someone can help me with a problem that has occured since I changed my device and now have to use MS 365.
I have a User Form which uses Vlookup to populate fields and which works perfectly well when the lookup value is alpha but now returns a Runtime 1004 error when the lookup value is numeric. This was not, and is not an issue if I use an earlier version of Excel.
The user form has a number of fields (textboxes) that are populated with lookup information and I get the same result with each. I also have coded the function to show a message box if the lookup value cannot be found and this works fine with Alpha values. But with the numeric values the process generates the runtime error 1004, hence the check is not performed.
Sample Code:
Private Sub txtDepotCode_AfterUpdate()
If WorksheetFunction.CountIf(Sheet3.Range("E3:G400"), Me.txtDepotCode.Value) = 0 Then
MsgBox "This is an invalid code", 0, "Validation Check"
Me.txtDepotCode.SetFocus
Me.txtDepotCode.Value = ""
Exit Sub
End If
With Me
.txtDepotLocation = Application.WorksheetFunction.VLookup(Me.txtDepotCode, Sheet3.Range("E3:G400"), 2, False)
.txtDepotOperator = Application.WorksheetFunction.VLookup(Me.txtDepotCode, Sheet3.Range("E3:G400"), 3, False)
End With
End Sub
Error Message
Run-time error "1004"
Unable to get the Vlookup property of the WorksheetFunction class
I am hoping that this is not caused by using MS365 32-bit
Any help would be most welcome
I am hoping that someone can help me with a problem that has occured since I changed my device and now have to use MS 365.
I have a User Form which uses Vlookup to populate fields and which works perfectly well when the lookup value is alpha but now returns a Runtime 1004 error when the lookup value is numeric. This was not, and is not an issue if I use an earlier version of Excel.
The user form has a number of fields (textboxes) that are populated with lookup information and I get the same result with each. I also have coded the function to show a message box if the lookup value cannot be found and this works fine with Alpha values. But with the numeric values the process generates the runtime error 1004, hence the check is not performed.
Sample Code:
Private Sub txtDepotCode_AfterUpdate()
If WorksheetFunction.CountIf(Sheet3.Range("E3:G400"), Me.txtDepotCode.Value) = 0 Then
MsgBox "This is an invalid code", 0, "Validation Check"
Me.txtDepotCode.SetFocus
Me.txtDepotCode.Value = ""
Exit Sub
End If
With Me
.txtDepotLocation = Application.WorksheetFunction.VLookup(Me.txtDepotCode, Sheet3.Range("E3:G400"), 2, False)
.txtDepotOperator = Application.WorksheetFunction.VLookup(Me.txtDepotCode, Sheet3.Range("E3:G400"), 3, False)
End With
End Sub
Error Message
Run-time error "1004"
Unable to get the Vlookup property of the WorksheetFunction class
I am hoping that this is not caused by using MS365 32-bit
Any help would be most welcome