hello
i m using a userform to find data, edit data and update data.....when i click
CommandButton2 to update data an error is comming
QuoteRun-time error '13':
Type mismatch
Code
Private Sub ComboBox1_Change()
Dim v As Variant
Dim r As Range
Set r = Sheet4.Range("D61:D500")
v = Application.Match(CDbl(ComboBox1.Value), r, False)
If Not IsError(v) Then
TextBox1.Value = r.Cells(v).Offset(0, -1).Value
TextBox2.Value = r.Cells(v).Offset(0, -3).Value
TextBox3.Value = r.Cells(v).Offset(0, 1).Value
TextBox4.Value = r.Cells(v).Offset(0, 2).Value
TextBox5.Value = r.Cells(v).Offset(0, 3).Value
TextBox6.Value = r.Cells(v).Offset(0, 4).Value
'MsgBox "Now you can edit."
End If
End Sub
Display More
Code
Private Sub CommandButton2_Click()
Dim v As Variant
Dim r As Range
Set r = Sheet4.Range("D61:D500")
v = Application.Match(CDbl(ComboBox1.Value), r, False)
If Not IsError(v) Then
r.Cells(v).Offset(0, -1).Value = TextBox1.Value
r.Cells(v).Offset(0, -3).Value = TextBox2.Value
r.Cells(v).Offset(0, 1).Value = TextBox3.Value
r.Cells(v).Offset(0, 2).Value = TextBox4.Value
r.Cells(v).Offset(0, 3).Value = TextBox5.Value
r.Cells(v).Offset(0, 4).Value = TextBox6.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
ComboBox1.Value = ""
MsgBox "successful edited."
'Exit Sub
'Else
'End If
'Else
'Exit Sub
End If
'Next
End Sub
Display More
need help
thanx