Private Sub ComboBox1_Change()
Dim flag As Boolean
Dim Rowcnt2, x2 As Integer
Dim first, second, user_price As Variant
flag = False
Rowcnt2 = Sheets("analysis").Cells(1, 1).CurrentRegion.Rows.Count
For x2 = 1 To Rowcnt2
If Sheets("analysis").Cells(x2, 1) = UserForm2.ComboBox1.Value Then
TextBox2 = Sheets("analysis").Cells(x2, 2)
TextBox5 = Sheets("analysis").Cells(x2, 7)
TextBox6 = Sheets("analysis").Cells(x2, 4)
TextBox3 = Sheets("analysis").Cells(x2, 5)
TextBox4 = Sheets("analysis").Cells(x2, 6)
TextBox7 = Sheets("analysis").Cells(x2, 8)
TextBox8 = Sheets("analysis").Cells(x2, 9)
flag = True
End If
Next
TextBox26.Value = TextBox8.Value - TextBox7.Value
TextBox27.Value = TextBox26.Value / TextBox8.Value
End Sub
Private Sub OptionButton1_Click()
Dim price_min, ratio, diff As Variant
If OptionButton1 = True Then
If TextBox15.Value = "" And TextBox18.Value = "" Then
price_min = TextBox12.Value
ElseIf TextBox15.Value <> "" And TextBox18.Value = "" Then
price_min = Application.Min(TextBox12.Value, TextBox15.Value)
Else
price_min = Application.Min(TextBox12.Value, TextBox15.Value, TextBox18.Value)
End If
diff = TextBox12.Value - price_min
ratio = diff / TextBox7.Value
TextBox21.Value= diff
TextBox22.Value = ratio
Else
TextBox21.Text = ""
TextBox22.Text = ""
End If
End Sub作者: GBKEE 時間: 2013-4-23 14:38