Option Explicit
Sub Button2_Click()
UserForm2.Show
End Sub
Sub unprotectsheet()
Sheet3.Unprotect Password:="Password"
End Sub
Private Sub CommandButton1_Click()
If UCase(UserForm1.ComboBox1.Value) = UCase("New") Then Call Code1 Else Call code2
End Sub
Sub Code1()
Dim erow As Long
erow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
Sheet3.Cells(erow, 1).Value = Me.TextBox1.Text
Sheet3.Cells(erow, 2).Value = Me.ComboBox2.Text
Sheet3.Cells(erow, 3).Value = Me.ComboBox3.Text
Sheet3.Cells(erow, 6).Value = Me.TextBox2.Text
Sheet3.Cells(erow, 7).Value = Me.ComboBox5.Text
Sheet3.Cells(erow, 8).Value = Me.ComboBox6.Text
Sheet3.Cells(erow, 9).Value = Me.TextBox7.Text
Sheet3.Cells(erow, 10).Value = Me.TextBox8.Text
Sheet3.Cells(erow, 12).Value = Me.TextBox9.Text
Sheet3.Cells(erow, 14).Value = Me.TextBox31.Text
Sheet3.Cells(erow, 13).Value = Me.TextBox29.Text
Sheet3.Cells(erow, 17).Value = Me.TextBox11.Text
Sheet3.Cells(erow, 47).Value = Me.TextBox24.Text
Sheet3.Cells(erow, 48).Value = Me.TextBox25.Text
Sheet3.Cells(erow, 49).Value = Me.TextBox26.Text
Sheet3.Cells(erow, 50).Value = Me.TextBox27.Text
Sheet3.Cells(erow, 52).Value = Me.ComboBox19.Text
Sheet3.Cells(erow, 54).Value = Me.TextBox3.Text
Sheet3.Cells(erow, 55).Value = Me.TextBox4.Text
Sheet3.Cells(erow, 56).Value = Me.TextBox5.Text
Sheet3.Cells(erow, 57).Value = Me.TextBox6.Text
Sheet3.Cells(erow, 58).Value = Me.TextBox30.Text
Sheet3.Cells(erow, 18).Value = Me.ComboBox7.Text
Sheet3.Cells(erow, 19).Value = Me.ComboBox8.Text
Sheet3.Cells(erow, 20).Value = Me.ComboBox9.Text
Sheet3.Cells(erow, 21).Value = Me.ComboBox10.Text
Sheet3.Cells(erow, 22).Value = Me.ComboBox11.Text
Sheet3.Cells(erow, 23).Value = Me.ComboBox12.Text
Sheet3.Cells(erow, 24).Value = Me.ComboBox13.Text
Sheet3.Cells(erow, 25).Value = Me.ComboBox14.Text
Sheet3.Cells(erow, 26).Value = Me.ComboBox15.Text
Sheet3.Cells(erow, 27).Value = Me.ComboBox16.Text
Sheet3.Cells(erow, 28).Value = Me.ComboBox17.Text
Sheet3.Cells(erow, 29).Value = Me.ComboBox18.Text
End Sub
Sub code2()
If ComboBox1.ListIndex <> -1 Then
TextBox1.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 0).Resize(1, 1)
TextBox2.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 5).Resize(1, 1)
ComboBox2.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 1).Resize(1, 1)
ComboBox4.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 4).Resize(1, 1)
ComboBox3.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 2).Resize(1, 1)
ComboBox5.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 6).Resize(1, 1)
ComboBox6.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 7).Resize(1, 1)
TextBox3.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 54).Resize(1, 1)
TextBox4.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 55).Resize(1, 1)
TextBox5.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 56).Resize(1, 1)
TextBox6.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 57).Resize(1, 1)
TextBox7.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 8).Resize(1, 1)
TextBox8.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 9).Resize(1, 1)
TextBox9.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 12).Resize(1, 1)
TextBox27.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 50).Resize(1, 1)
TextBox32.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 11).Resize(1, 1)
TextBox11.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 17).Resize(1, 1)
ComboBox7.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 18).Resize(1, 1)
ComboBox8.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 19).Resize(1, 1)
ComboBox9.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 20).Resize(1, 1)
ComboBox10.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 21).Resize(1, 1)
ComboBox11.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 22).Resize(1, 1)
ComboBox12.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 23).Resize(1, 1)
ComboBox13.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 24).Resize(1, 1)
ComboBox14.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 25).Resize(1, 1)
ComboBox15.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 26).Resize(1, 1)
ComboBox16.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 27).Resize(1, 1)
ComboBox17.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 28).Resize(1, 1)
ComboBox18.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 29).Resize(1, 1)
TextBox30.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 58).Resize(1, 1)
TextBox24.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 47).Resize(1, 1)
TextBox25.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 48).Resize(1, 1)
TextBox26.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 49).Resize(1, 1)
ComboBox19.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 52).Resize(1, 1)
TextBox29.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 13).Resize(1, 1)
TextBox31.Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 14).Resize(1, 1)
With TextBox27
Value = Range(ComboBox1.RowSource).Offset(ComboBox1.ListIndex, 50).Resize(1, 1)
.Enabled = (Len(.Value) = 0)
End With
End If
End Sub
Sub Protectsheet()
Sheet3.Protect Password:="Password"
End Sub
Bookmarks