|
楼主 |
发表于 2016-9-3 22:57
|
显示全部楼层
xlcywj 发表于 2016-9-3 22:56
我设置了变量,如下:
If TextBox5.Text = "" Then
'TextBox5.SetFocus
文本框完整代码如下:
Private Sub TextBox5_EXIT(ByVal cancel As MSForms.ReturnBoolean)
'TextBox5.SetFocus
'BC段最高收盘价格判断
'TextBox5.Text:BC段最高收盘价输入文本框 对应工作簿中的290列
Dim A点价格, B点价格, C点价格, BC段最高收盘价 As String
A点价格 = TextBox1.Text
B点价格 = TextBox2.Text
C点价格 = (TextBox1.Text - TextBox2.Text) / 2 + TextBox2.Text
E点价格 = (TextBox1.Text - TextBox2.Text) * 0.75 + TextBox2.Text
BC段最高收盘价 = TextBox5.Text
'BC段最高收盘价大于等与E点价格 BC段无效判断代码
If TextBox5.Text = "" Then
'TextBox5.SetFocus
MsgBox "该参数涉及到计算值,不能为空"
1: BC段最高收盘价 = InputBox("请输入BC段最高收盘价格")
If BC段最高收盘价 = "" Then
GoTo 1
Else
TextBox5.Text = BC段最高收盘价
'GoTo 2
If TextBox5.Text >= E点价格 Then
Dim BC_5 As Long
Dim BC_6 As Long
BC_5 = MsgBox("BC段最高收盘价超过AB段幅度75%计算价,属于BC段无效,2元次建仓形态要素不达标。请审核填入的参数,如输入无误,点击“确定”按钮,结束2元次建仓3买位形态判断。重新输入选“否”", vbYesNo)
If BC_5 = vbNo Then
GoTo 1
Else
For BC_6 = 8 To Range("P500").End(xlUp).Row
If Cells(BC_6, 17) = "2元次建仓" And Cells(BC_6, 294) = "" Then
Cells(BC_6, 294) = "BC段无效" 'LABEL15:文本标题,内容:BC段完成参数输入,有效!
Cells(BC_6, 17) = ""
Cells(BC_6, 17) = "2元次建仓3买位判断无效,请选择其他坐庄类型"
End If
Next BC_6
Unload UserForm3
End If
End If
End If
Else
'如果窗体中的TEXTBOX5中输入了数据,执行下面判断代码
'TextBox5.SetFocus
2: If TextBox5.Text >= E点价格 Then
Dim BC_3 As Long
Dim BC_4 As Long
BC_3 = MsgBox("BC段最高收盘价超过AB段幅度75%计算价,属于BC段无效,2元次建仓形态要素不达标。请审核填入的参数,如输入无误,点击“确定”按钮,结束2元次建仓3买位形态判断。重新输入选“否”", vbYesNo)
If BC_3 = vbNo Then
GoTo 1
Else
Dim BC_2 As Long
For BC_2 = 8 To Range("P500").End(xlUp).Row
If Cells(BC_2, 17) = "2元次建仓" And Cells(BC_2, 294) = "" Then
Cells(BC_2, 294) = "BC段无效" 'LABEL15:文本标题,内容:BC段完成参数输入,有效!
Cells(BC_2, 17) = ""
Cells(BC_2, 17) = "2元次建仓3买位判断无效,请选择其他坐庄类型"
Call T4
End If
Cells(BC_2, 16).Select
Next BC_2
Unload UserForm3
Exit Sub
End If
Else
'如果BC段最高上影线价格大于等于C点价格 并且 BC段的最高收盘价格小于E点价格 则BC段有效判断代码
If TextBox4.Text >= C点价格 And TextBox5.Text <= E点价格 Then
Label15.Visible = True
Application.Wait (Now + TimeValue("0:00:02"))
Label15.Visible = False
Dim BC_1 As Long
For BC_1 = 8 To Range("P500").End(xlUp).Row
If Cells(BC_1, 17) = "2元次建仓" And Cells(BC_1, 294) = "" Then
Cells(BC_1, 294) = Label15 'LABEL15:文本标题,内容:BC段完成参数输入,有效!
End If
Next BC_1
End If
End If
End If
End Sub
|
|