• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code for change & Delete In Userform

herofox

Active Member
hi every one
pls i want 2 code for Delete Buttone & Change Button From Userform when i make recall and Search Data By ComboBox1
thank you very much
 

Attachments

  • Untitled.png
    Untitled.png
    74.4 KB · Views: 11
  • Userform.xlsm
    20 KB · Views: 14
Remove the Rowsource property of the combo & use
Code:
Private Sub CommandButton2_Click()
   Dim x As Long
   x = Me.ComboBox1.ListIndex + 2

   Sheets("Statement").Rows(x).Delete
End Sub

Private Sub CommandButton3_Click()
   Dim x As Long
   x = Me.ComboBox1.ListIndex + 2
   With Sheets("Statement")
      .Cells(x, 1) = Me.TextBox1.Value
      .Cells(x, 2) = Me.TextBox2.Value
      .Cells(x, 3) = Me.TextBox3.Value
   End With
End Sub

Private Sub UserForm_Initialize()
   With Sheets("Statement")
      Me.ComboBox1.List = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).Value
   End With
End Sub
 
Back
Top