Magoo360
08-23-2010, 10:10 AM
Hi, I am new to VBA and have been working on this userform for a number of days. I am very new to VBA and how I got this far is taking examples from the internet and adapting them to what I need. But now I am getting a
"Run Time Error 13" Type Mismatch Error that I cannot figure out what is wrong, please help me out: Here is the code the highlighted line is what the debugger points to:
The error happens and soon as I select the value in the combo box and move to the next text box.
Any help in solving this would be much appreciated. If you need any further explanation please dont hesitiate to ask. Thanks.
Dim NotNow As Boolean
Private Sub btnExit_Click()
'Unload the userform
Unload Me
End Sub
Private Sub btnSearch_Click()
NotNow = True
n = Application.Match(Me.cboEstNo.Value, Range("A:A"), 0)
Cells(n, 2).Value = Me.txtDescrip.Text
Cells(n, 12).Value = Me.cboStatus.Value
Cells(n, 16).Value = Me.txtBidAmt.Text
Cells(n, 15).Value = Me.txtSuccess.Text
Cells(n, 20).Value = Me.txtComp.Text
NotNow = False
End Sub
Private Sub cboEstNo_Change()
If NotNow Then Exit Sub
'vrange = "A1:Y" & Cells(Rows.Count, "A").End(x1up).Row
vrange = "EditData"
txtDescrip.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 2, False)
cboStatus.Value = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 12, False)
txtBidAmt.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 16, False)
txtSuccess.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 15, False)
txtComp.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 20, False)
End Sub
Private Sub UserForm_Initialize()
'UserForm2.Combox1.RowSource ="A2"Y" & Cells(Rows.Count, "A").End(x1up).Row
frmSearch.cboEstNo.RowSource = "EditData"
End Sub
Private Sub UserForm_Click()
End Sub
"Run Time Error 13" Type Mismatch Error that I cannot figure out what is wrong, please help me out: Here is the code the highlighted line is what the debugger points to:
The error happens and soon as I select the value in the combo box and move to the next text box.
Any help in solving this would be much appreciated. If you need any further explanation please dont hesitiate to ask. Thanks.
Dim NotNow As Boolean
Private Sub btnExit_Click()
'Unload the userform
Unload Me
End Sub
Private Sub btnSearch_Click()
NotNow = True
n = Application.Match(Me.cboEstNo.Value, Range("A:A"), 0)
Cells(n, 2).Value = Me.txtDescrip.Text
Cells(n, 12).Value = Me.cboStatus.Value
Cells(n, 16).Value = Me.txtBidAmt.Text
Cells(n, 15).Value = Me.txtSuccess.Text
Cells(n, 20).Value = Me.txtComp.Text
NotNow = False
End Sub
Private Sub cboEstNo_Change()
If NotNow Then Exit Sub
'vrange = "A1:Y" & Cells(Rows.Count, "A").End(x1up).Row
vrange = "EditData"
txtDescrip.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 2, False)
cboStatus.Value = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 12, False)
txtBidAmt.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 16, False)
txtSuccess.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 15, False)
txtComp.Text = Application.VLookup(cboEstNo.Value, Sheets("BidData").Range(vrange), 20, False)
End Sub
Private Sub UserForm_Initialize()
'UserForm2.Combox1.RowSource ="A2"Y" & Cells(Rows.Count, "A").End(x1up).Row
frmSearch.cboEstNo.RowSource = "EditData"
End Sub
Private Sub UserForm_Click()
End Sub