gleamng
Board Regular
- Joined
- Oct 8, 2016
- Messages
- 98
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- 2003 or older
- Platform
- Windows
- MacOS
- Mobile
- Web
Good morning everyone
i have been having a running battle with Run-time error 1004 on this code, while i had tried many online solutions, yet i am stuck with this error.
Summarily, after trying the vlookup function, i also tried index & match function and get the same error code, so i was thinking may worksheet function dont want to work for my pet project, please kindly help this novice out. below is my vba code and thank you for your support & help.
i have been having a running battle with Run-time error 1004 on this code, while i had tried many online solutions, yet i am stuck with this error.
Summarily, after trying the vlookup function, i also tried index & match function and get the same error code, so i was thinking may worksheet function dont want to work for my pet project, please kindly help this novice out. below is my vba code and thank you for your support & help.
VBA Code:
Private Sub cmbItemID_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("ProductMaster")
If Me.cmbItemID.Value = "" Then Me.txtRate.Value = ""
Else
Me.txtRate.Value = Application.WorksheetFunction.VLookup(Me.cmbItemID.Value, sh.Range("B:F"), 5, False)
End If
End Sub