You are on page 1of 2

Private Sub Worksheet_Change(ByVal Target As Range)

Dim KeyCells As Range


' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("H3:I3")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
If (WorksheetFunction.CountA(Range("H3:I3")) = 2) Then
Range("J3").Value = Range("H3").Value * Range("I3").Value * 1.5
Else
Range("J3").Value = ""
End If
End If
End Sub

Private Sub cmdExecute_Click()


If (comboDBA.Value <> "" And comboPlan.Value <> "") Then
txtBox2.Value = comboDBA.Value * comboPlan.Value * 1.5
Else
txtBox2.Value = ""
End If
End Sub

Private Sub comboDBA_Change()


If (comboDBA.Value <> "" And comboPlan.Value <> "") Then
txtBox1.Value = comboDBA.Value * comboPlan.Value * 1.5
Else
txtBox1.Value = ""
End If
End Sub
Private Sub comboPlan_Change()
If (comboDBA.Value <> "" And comboPlan.Value <> "") Then
txtBox1.Value = comboDBA.Value * comboPlan.Value * 1.5
Else
txtBox1.Value = ""
End If
End Sub

Private Sub CommandButton21_Click()

myArray1 = Split("1|2|3|4|" _
& "5|6|7|8|" _
& "9|10|11|12", "|")
myArray2 = Split("100|150|200|250|300|350|400|450|", "|")
UserForm1.ComboBox1.List = myArray1
UserForm1.ComboBox2.List = myArray2
UserForm1.Show

End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Selection.Address = "$D$3" Then
myArray1 = Split("1|2|3|4|" _
& "5|6|7|8|" _
& "9|10|11|12", "|")
myArray2 = Split("100|150|200|250|300|350|400|450|", "|")
UserForm1.ComboBox1.List = myArray1
UserForm1.ComboBox2.List = myArray2
UserForm1.Show
End If
End Sub

Private Sub ComboBox1_Change()


If (ComboBox1.Value <> "" And ComboBox2.Value <> "") Then
TextBox1.Value = ComboBox1.Value * ComboBox2.Value * 1.5
Else
TextBox1.Value = ""
End If
End Sub
Private Sub ComboBox2_Change()
If (ComboBox1.Value <> "" And ComboBox2.Value <> "") Then
TextBox1.Value = ComboBox1.Value * ComboBox2.Value * 1.5
Else
TextBox1.Value = ""
End If
End Sub
Private Sub CommandButton1_Click()
Range("F3").Value = TextBox1.Value
UserForm1.Hide
End Sub

You might also like