Jee Moon
09-21-2015, 03:53 AM
Hi,
I am new in forum i have problem in excel vba userform.
here i excel vba userform i have
1.Two text box
2. I display excel sheet data into excel vba userform textbox
3. when i enter the excel sheet 1st row value in textbox1 than textbox2 show the 2nd row value through vlookup function but vlookup give mistmatch run time error 13.
Here i inser code
Private Sub TextBox1_Change()
'Check to see if value exists
If WorksheetFunction.CountIf(Sheet1.Range("A:B"), Me.TextBox1.Value) = 0 Then
MsgBox "This is an incorrect ID"
Me.TextBox1.Value = ""
Exit Sub
End If
'Lookup values based on first control
With Me
.TextBox2.Value = Application.WorksheetFunction.VLookup(CLng(Me.TextBox1.Value), Sheet1.Range("A:B"), 2, True)
End With
End Sub
Please check where i do mistake
I am new in forum i have problem in excel vba userform.
here i excel vba userform i have
1.Two text box
2. I display excel sheet data into excel vba userform textbox
3. when i enter the excel sheet 1st row value in textbox1 than textbox2 show the 2nd row value through vlookup function but vlookup give mistmatch run time error 13.
Here i inser code
Private Sub TextBox1_Change()
'Check to see if value exists
If WorksheetFunction.CountIf(Sheet1.Range("A:B"), Me.TextBox1.Value) = 0 Then
MsgBox "This is an incorrect ID"
Me.TextBox1.Value = ""
Exit Sub
End If
'Lookup values based on first control
With Me
.TextBox2.Value = Application.WorksheetFunction.VLookup(CLng(Me.TextBox1.Value), Sheet1.Range("A:B"), 2, True)
End With
End Sub
Please check where i do mistake