i got a error as type mismatch



i need to get a value from the excel which has integer value by selecting a text From cell Range “A” (by selecting a Cell “A” need to get a particular value of cell “B”)

i don’t know where i made a mistake pls help me out



Private Sub ComboBox1_Change()
Dim i As Long, LastRow As Long
LastRow = Sheets(“sheet1”).Range(“A” & Rows.Count).End(xlUp).Rows
For i = 2 To LastRow
If Sheets(“sheet1”).Cells(i, “A”).Value = (Me.ComboBox1) Or Sheets(“sheet1”).Cells(i, “A”).Value = Val(Me.ComboBox1) Then
Me.TextBox2 = Sheets(“sheet1”).Cells(i, “B”).Value
End If
End Sub

Private Sub ComboBox1_dropbuttonClick()
Dim i As Long, LastRow As Long
LastRow = Sheets(“sheet1”).Range(“B” & Rows.Count).End(xlUp).row
If Me.ComboBox1.ListCount = 0 Then
For i = 2 To LastRow
Me.ComboBox1.AddItem Sheets(“sheet1”).Cells(i, “A”).Value
Next i
End If
End Sub

Participant Asked 3 hours ago in VBA: User Forms.
Add Comment
0 Answer(s)
  • Found this useful?

    Please share using the share button above.

    If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.

    Found the answer useful and wants to credit the user, then vote the answer (vote up).

  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.