vlookup? on a text/combo box

kelvin_9

Active Member
Joined
Mar 6, 2015
Messages
444
Office Version
  1. 2019
greeting all. i have some questions on vba text/combo box

i'm planning to create a form for data entry with my item list database
I need help on "textbox2" & "textbox3" to update when "textbox1" is entered like a vlookup formula, however i stuck with the code
here come with my template, can anyone give a helping hand on any solution?
http://kel.ddns.net/f/7bb54844a2/?raw=1
thanks a lot
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
sorry for the code missing

VBA Code:
Private Sub TextBox1_Change()
    Dim sh As Worksheet
    Set sh = ThisWorkbook.Sheets("sheet2")
    Dim itemcode As Variant
   
    If Me.TextBox1.Value <> "" Then
        'On Error Resume Next
        If IsNumeric(Me.TextBox1.Value) Then
            itemcode = CLng(Me.TextBox1.Value)
        Else
            itemcode = Me.TextBox1.Value
        End If
       
       
        Me.TextBox2.Value = Application.WorksheetFunction.VLookup(itemcode, sh.Range("A:C"), 2, 0)
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top