View Full Version : Solved: Update worksheet data through userform

08-27-2008, 07:28 AM
I encounter problem when I try to update/change data selected through "edit" form. The macro return error message as " Runtime error 13 -Type mismatch":dunno when button change was click. Is there anything wrong with the code ? Please assist.

Thank you

Bob Phillips
08-27-2008, 08:26 AM
I don't get an error. It doesn't seem to work, but it doesn't error. What data should I try to force an error?

08-27-2008, 08:52 AM
The error will appear if select any item in list box and click on edit selection button. After change of data in edit form and click image icon for update to worksheet("ALLSSE"). Error pointed at the following code ".Cells(Me.Tbname.Value, "B").Value = Me.Tbname.Value "

Bob Phillips
08-27-2008, 09:14 AM
Didn't realise the picture was a button!

Private Sub Img_cmdchange_Click()

With Worksheets("ALLSSE")
.Cells(FrmMain.ListBox1.ListIndex + 2, "B").Value = Me.Tbname.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "c") = Me.TbcsdsNo.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "D") = Me.Tbname.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "E") = Me.TbWdnBy.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "F") = Me.Tbwdnreason.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "G") = Me.TbCACAuth.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "H") = Me.TbacctNo.Value
.Cells(FrmMain.ListBox1.ListIndex + 2, "I") = Me.Tbdateout.Value
End With

Unload Me

Cells.Sort Key1:=Range("B2"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

End Sub

08-27-2008, 07:46 PM
Thanks Xld. You are great !