I'm using this macro to populate my parts database thru a pop-up dialog box along with a "Add Part" button that initiates the Pop-up Dialog box using the module below.
It works great for the first part! But when I push the "Add Part" button for the next part, the fields are still populated with the 1st parts information. Is there a reset code I have to add to the macro to clear the fields of the Pop-up after hitting OK? Thx for the help!
Private Sub cmdOK_Click()
Sheets("SHEET METAL").Select
Range("A7").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 0).Value = Me.TextBox1.Value
ActiveCell.Offset(0, 1).Value = Me.TextBox2.Value
ActiveCell.Offset(0, 2).Value = Me.TextBox3.Value
ActiveCell.Offset(0, 3).Value = Me.TextBox4.Value
ActiveCell.Offset(0, 7).Value = Me.TextBox5.Value
ActiveCell.Offset(0, 8).Value = Me.TextBox6.Value
ActiveCell.Offset(0, 9).Value = Me.TextBox7.Value
ActiveCell.Offset(0, 13).Value = Me.TextBox8.Value
ActiveCell.Offset(0, 25).Value = Me.TextBox9.Value
Me.Hide
End Sub
Module for "Add Part" button
Sub showForm1()
UserForm1.Show
End Sub
It works great for the first part! But when I push the "Add Part" button for the next part, the fields are still populated with the 1st parts information. Is there a reset code I have to add to the macro to clear the fields of the Pop-up after hitting OK? Thx for the help!
Private Sub cmdOK_Click()
Sheets("SHEET METAL").Select
Range("A7").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 0).Value = Me.TextBox1.Value
ActiveCell.Offset(0, 1).Value = Me.TextBox2.Value
ActiveCell.Offset(0, 2).Value = Me.TextBox3.Value
ActiveCell.Offset(0, 3).Value = Me.TextBox4.Value
ActiveCell.Offset(0, 7).Value = Me.TextBox5.Value
ActiveCell.Offset(0, 8).Value = Me.TextBox6.Value
ActiveCell.Offset(0, 9).Value = Me.TextBox7.Value
ActiveCell.Offset(0, 13).Value = Me.TextBox8.Value
ActiveCell.Offset(0, 25).Value = Me.TextBox9.Value
Me.Hide
End Sub
Module for "Add Part" button
Sub showForm1()
UserForm1.Show
End Sub