Clear userform fields upon submit

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,752
Office Version
  1. 2007
Platform
  1. Windows
Morning,

After i submit my form i would like to the have the field contents cleared so i can then start my second data input etc.

My code in use is supplied below.


Code:
Private Sub CommandButton1_Click()

    With Sheets("DATABASE")
    
    .Range("A6").Value = Me.TextBox1.Text
    .Range("B6").Value = Me.ComboBox1.Text
    .Range("C6").Value = Me.ComboBox2.Text
    .Range("D6").Value = Me.ComboBox3.Text
    .Range("E6").Value = Me.ComboBox4.Text
    .Range("F6").Value = Me.ComboBox5.Text
    .Range("G6").Value = Me.ComboBox6.Text
    .Range("H6").Value = Me.ComboBox7.Text
    .Range("I6").Value = Me.ComboBox8.Text
    .Range("J6").Value = Me.ComboBox9.Text
    .Range("K6").Value = Me.ComboBox10.Text
    .Range("L6").Value = Me.ComboBox11.Text
    .Range("M6").Value = Me.TextBox2.Text
    .Range("N6").Value = Me.ComboBox12.Text
    .Range("O6").Value = Me.TextBox3.Text
    .Range("P6").Value = Me.TextBox4.Text
    .Range("Q6").Value = Me.TextBox5.Text
End With
    .Me.TextBox.Text = ""
    .Me.ComboBox1.Text = ""
    .Me.ComboBox2.Text = ""
    .Me.ComboBox3.Text = ""
    .Me.ComboBox4.Text = ""
    .Me.ComboBox5.Text = ""
    .Me.ComboBox6.Text = ""
    .Me.ComboBox7.Text = ""
    .Me.ComboBox8.Text = ""
    .Me.ComboBox9.Text = ""
    .Me.ComboBox10.Text = ""
    .Me.ComboBox11.Text = ""
    .Me.TextBox2.Text = ""
    .Me.ComboBox12.Text = ""
    .Me.TextBox3.Text = ""
    .Me.TextBox4.Text = ""
    .Me.TextBox5.Text = ""
    
    TextBox2.Value = Now
    TextBox2 = Format(TextBox2.Value, "dd/mm/yyyy")
    TextBox1.SetFocus


End Sub


thanks
 
I was talking about the code in post 8 looks OK.

As far as Forms. I do not know how many Forms you are using now.

I have not been providing you with help on any but the first form if you have more then one.
I think someone else was giving you help and I have not been following your progress lately.
I know you have been asking other questions on the Forum but not about this project with the first form I do not believe.

I was just curious how your entire project with the Userform was progressing.

I just thought that project was completed till I saw this post today.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
OK
I now understand.

You helped out with a code say 1 week ago for my userform.
It would take the data from the userform & put it into my worksheet.
I believe it was the one where you advised to put the Option Bullets into a frame.

I was so impressed by how it worked i then decided to make this new form of which this thread is for.

Many thanks for the follow up.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,632
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top