I'm creating a User Form that will basically automate user input into an Excel Sheet for my organization. I have 3 Sheets on this Workbook labelled: Menu, Master and Data Validation. The Menu sheet allows users to select any forms available (connected through macros), the Master sheet saves all information that is input from sheets and Data Validation sheet is connected to some combo boxes available in the forms for easy updating.
Upon clicking submit on the User Form I always received error messages, even having tried multiple VBA codes and trying to make sense of these. Basically what I want is all the information from the User Form after clicking a submit button to be input into the Master sheet at the next available empty row. Any help is appreciated in advanced and below you will find my current code for my submit button:
Private Sub CommandButton1_Click()
Dim LR As Long 'LR = Last Row
Sheet1.Activate 'Activates the database sheet
LR = Sheet1.Cells(Rows.Count, 1).End(x1Up).Row
With Sheet1 'Each part of the form submitted into a separate column
.Range("A" & LR).Value = ComboBox1.Value
.Range("B" & LR).Value = ComboBox2.Value
.Range("C" & LR).Value = ComboBox3.Value
.Range("D" & LR).Value = TextBox1.Value
.Range("E" & LR).Value = TextBox2.Value
.Range("F" & LR).Value = TextBox3.Value
.Range("G" & LR).Value = TextBox4.Value
.Range("H" & LR).Value = ComboBox4.Value
.Range("I" & LR).Value = ComboBox5.Value
.Range("J" & LR).Value = TextBox5.Value
.Range("K" & LR).Value = ComboBox6.Value
End With 'Resets form to blank state after submitting
Me.ComboBox1.Value = Null
Me.ComboBox2.Value = Null
Me.ComboBox3.Value = Null
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.ComboBox4.Value = Null
Me.ComboBox5.Value = Null
Me.TextBox5.Value = ""
Me.ComboBox6.Value = Null
End Sub
Upon clicking submit on the User Form I always received error messages, even having tried multiple VBA codes and trying to make sense of these. Basically what I want is all the information from the User Form after clicking a submit button to be input into the Master sheet at the next available empty row. Any help is appreciated in advanced and below you will find my current code for my submit button:
Private Sub CommandButton1_Click()
Dim LR As Long 'LR = Last Row
Sheet1.Activate 'Activates the database sheet
LR = Sheet1.Cells(Rows.Count, 1).End(x1Up).Row
With Sheet1 'Each part of the form submitted into a separate column
.Range("A" & LR).Value = ComboBox1.Value
.Range("B" & LR).Value = ComboBox2.Value
.Range("C" & LR).Value = ComboBox3.Value
.Range("D" & LR).Value = TextBox1.Value
.Range("E" & LR).Value = TextBox2.Value
.Range("F" & LR).Value = TextBox3.Value
.Range("G" & LR).Value = TextBox4.Value
.Range("H" & LR).Value = ComboBox4.Value
.Range("I" & LR).Value = ComboBox5.Value
.Range("J" & LR).Value = TextBox5.Value
.Range("K" & LR).Value = ComboBox6.Value
End With 'Resets form to blank state after submitting
Me.ComboBox1.Value = Null
Me.ComboBox2.Value = Null
Me.ComboBox3.Value = Null
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.ComboBox4.Value = Null
Me.ComboBox5.Value = Null
Me.TextBox5.Value = ""
Me.ComboBox6.Value = Null
End Sub