Consulting

Results 1 to 5 of 5

Thread: Solved: Update worksheet data through userform

  1. #1
    VBAX Contributor
    Joined
    Sep 2007
    Posts
    119
    Location

    Solved: Update worksheet data through userform

    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" when button change was click. Is there anything wrong with the code ? Please assist.

    Thank you

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Sep 2007
    Posts
    119
    Location
    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 "

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Didn't realise the picture was a button!

    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Contributor
    Joined
    Sep 2007
    Posts
    119
    Location
    Thanks Xld. You are great !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •