Private Sub UserForm_Initialize()
'Empty TextBox1
TextBox1.Value = ""
'Empty TextBox2
TextBox2.Value = ""
'Empty TextBox3
TextBox3.Value = ""
'Empty TextBox4
TextBox4.Value = ""
'Empty TextBox5
TextBox5.Value = ""
'Empty TextBox6
TextBox6.Value = ""
'EmptyTextBox7
TextBox7.Value = ""
'EmptyTextBox8
TextBox8.Value = ""
'EmptyTextBox9
TextBox9.Value = ""
'EmptyTextBox10
TextBox10.Value = ""
'EmptyTextBox11
TextBox11.Value = ""
'EmptyTextBox12
TextBox12.Value = ""
'EmptyTextBox13
TextBox13.Value = ""
'EmptyTextBox14
TextBox14.Value = "Mr. Name 001"
'EmptyTextBox15
TextBox15.Value = ""
'EmptyTextBox16
TextBox16.Value = ""
'EmptyTextBox17
TextBox17.Value = ""
'EmptyTextBox18
TextBox18.Value = ""
'EmptyTextBox19
TextBox19.Value = ""
'EmptyTextBox20
TextBox20.Value = ""
'EmptyTextBox21
TextBox20.Value = ""
'EmptyTextBox22
TextBox22.Value = ""
'EmptyTextBox23
TextBox23.Value = ""
'EmptyTextBox24
TextBox24.Value = "Mr. Name 002"
'EmptyTextBox25
TextBox25.Value = ""
'EmptyTextBox26
TextBox26.Value = ""
'EmptyTextBox27
TextBox27.Value = "Mr. Name 003"
'EmptyTextBox28
TextBox28.Value = "Mr. B.K. Sundar"
'Empty ComboBox1
ComboBox1.Clear
'Fill ComboBox1
With ComboBox1
.AddItem "Mr. Name 004"
.AddItem "Mr. Name 005"
.AddItem "Mr. Name 006"
.AddItem "Mr. Name 007"
.AddItem "Mr. Name 008"
End With
End Sub
Private Sub CheckBox1_Click()
If CheckBox1.Value And CheckBox2.Value And CheckBox3.Value Then
CheckBox4.Value = True
Else
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox1.Value And CheckBox2.Value And CheckBox3.Value Then
CheckBox4.Value = True
Else
CheckBox1.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
End If
End Sub
Private Sub CheckBox3_Click()
If CheckBox1.Value And CheckBox2.Value And CheckBox3.Value Then
CheckBox4.Value = True
Else
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox4.Value = False
End If
End Sub
Private Sub CheckBox4_Click()
If CheckBox1.Value And CheckBox2.Value And CheckBox3.Value Then
CheckBox4.Value = True
Else
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False
End If
End Sub
Private Sub OKButton_Click()
Dim emptyRow As Long
'Make Sheet1 Active
Sheets(1).Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
'Export Data to worksheet
Cells(emptyRow, 2).Value = TextBox1.Value
Cells(emptyRow, 3).Value = TextBox2.Value
Cells(emptyRow, 5).Value = TextBox3.Value
Cells(emptyRow, 6).Value = TextBox4.Value
Cells(emptyRow, 7).Value = TextBox5.Value
Cells(emptyRow, 8).Value = TextBox6.Value
Cells(emptyRow, 9).Value = TextBox7.Value
Cells(emptyRow, 10).Value = TextBox10.Value
Cells(emptyRow, 11).Value = TextBox11.Value
Cells(emptyRow, 12).Value = TextBox8.Value
Cells(emptyRow, 13).Value = TextBox9.Value
Cells(emptyRow, 14).Value = TextBox12.Value
Cells(emptyRow, 15).Value = TextBox13.Value
Cells(emptyRow, 16).Value = TextBox14.Value
Cells(emptyRow, 17).Value = TextBox15.Value
Cells(emptyRow, 18).Value = TextBox16.Value
Cells(emptyRow, 19).Value = TextBox17.Value
Cells(emptyRow, 20).Value = TextBox18.Value
Cells(emptyRow, 21).Value = TextBox19.Value
Cells(emptyRow, 22).Value = TextBox20.Value
Cells(emptyRow, 23).Value = TextBox21.Value
Cells(emptyRow, 24).Value = TextBox22.Value
Cells(emptyRow, 25).Value = TextBox23.Value
Cells(emptyRow, 26).Value = TextBox24.Value
Cells(emptyRow, 27).Value = TextBox25.Value
Cells(emptyRow, 28).Value = TextBox26.Value
Cells(emptyRow, 29).Value = TextBox27.Value
Cells(emptyRow, 30).Value = TextBox28.Value
Cells(emptyRow, 31).Value = ComboBox1.Value
'If CheckBox1.Value = True Then Cells(emptyRow, 4).Value = CheckBox1.Caption
'
'If CheckBox2.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox2.Caption
'
'If CheckBox3.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox3.Caption
'
'If CheckBox4.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox4.Caption
Dim c As Control
Dim hasselect As Boolean
hasselect = False
For Each c In Frame1.Controls
If TypeName(c) = "CheckBox" And c.Value = True Then
hasselect = True
Exit For
End If
Next c
If hasselect Then Cells(emptyRow, 4).Value = c.Caption Else _
MsgBox "Come on! Please THICK One!": Exit Sub
Make sure name is entered
If TextBox1.Text = "" Then
MsgBox "You must enter a year"
If TextBox2.Text = "" Then
MsgBox "You must enter a date"
If TextBox3.Text = "" Then
MsgBox "You must enter Stock Quantity (Tons)"
If TextBox4.Text = "" Then
MsgBox "You must enter Stock Quantity (BDTons)"
If TextBox5.Text = "" Then
MsgBox "You must enter Stock Date"
If TextBox6.Text = "" Then
MsgBox "You must enter the Project Name"
If TextBox7.Text = "" Then
MsgBox "You must enter the Date"
If TextBox10.Text = "" Then
MsgBox "You must enter the Quantity for the Project"
If TextBox11.Text = "" Then
MsgBox "You must enter the Price for the Project"
If TextBox15.Text = "" Then
MsgBox "You must enter the Supplier Name"
If TextBox16.Text = "" Then
MsgBox "You must enter the Supplier Price"
If TextBox17.Text = "" Then
MsgBox "You must enter the Supplier Date"
If TextBox25.Text = "" Then
MsgBox "You must enter Proposed Price"
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
Unload Me
End Sub
Private Sub CancelButton_Click()
Unload Me
End Sub