|
以下标红色的是我想要定义实现的,首先我不想定义成sheets(表名)这样的类型,我只想要前面部分的名称,比如在vbe窗口看到如下的表名sheet9(一线)我只想要前面的sheet9,请高手帮忙解决一下,谢谢了
Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Integer
If TextBox3.Value = "" Then
MsgBox "厚度不能为空!!"
ElseIf TextBox4.Value = "" Then
MsgBox "长度不能为空!!"
ElseIf TextBox5.Value = "" Then
MsgBox "宽度不能为空!!"
ElseIf TextBox6.Value = "" Then
MsgBox "片数不能为空!!"
ElseIf ComboBox1.Value = "" Then
MsgBox "请选择包装方式!!"
ElseIf TextBox16.Value = "" Then
MsgBox "批次不能为空!!无批次请输入0!"
ElseIf 班组选择.ComboBox1.Value = "第一生产线" Then
one
ElseIf 班组选择.ComboBox1.Value = "第二生产线" Then
two
ElseIf 班组选择.ComboBox1.Value = "第三生产线" And 班组选择.ComboBox4.Value = "普通白玻" Then
i = 9
ElseIf 班组选择.ComboBox1.Value = "第三生产线" And 班组选择.ComboBox4.Value = "超白玻璃" Then
i = 8
ElseIf 班组选择.ComboBox1.Value = "第四生产线" And 班组选择.ComboBox4.Value = "普通白玻" Then
i = 7
End If
If TextBox7.Text = "" Then TextBox7.Text = 0
If TextBox8.Text = "" Then TextBox8.Text = 0
If TextBox9.Text = "" Then TextBox9.Text = 0
If TextBox10.Text = "" Then TextBox10.Text = 0
If TextBox11.Text = "" Then TextBox11.Text = 0
If TextBox12.Text = "" Then TextBox12.Text = 0
If TextBox13.Text = "" Then TextBox13.Text = 无
Sheet(i).Range("A65536").End(xlUp).Offset(1) = TextBox14.Text
Sheet(i).Range("B65536").End(xlUp).Offset(1) = TextBox1.Text
Sheet(i).Range("C65536").End(xlUp).Offset(1) = TextBox2.Text
Sheet(i).Range("D65536").End(xlUp).Offset(1) = TextBox3.Value
Sheet(i).Range("E65536").End(xlUp).Offset(1) = TextBox4.Value
Sheet(i).Range("F65536").End(xlUp).Offset(1) = TextBox5.Value
Sheet(i).Range("G65536").End(xlUp).Offset(1) = TextBox6.Text
Sheet(i).Range("H65536").End(xlUp).Offset(1) = ComboBox1.Text
Sheet(i).Range("I65536").End(xlUp).Offset(1) = TextBox7.Text
Sheet(i).Range("J65536").End(xlUp).Offset(1) = TextBox8.Text
Sheet(i).Range("K65536").End(xlUp).Offset(1) = TextBox9.Text
Sheet(i).Range("L65536").End(xlUp).Offset(1) = TextBox10.Text
Sheet(i).Range("M65536").End(xlUp).Offset(1) = TextBox11.Text
Sheet(i).Range("N65536").End(xlUp).Offset(1) = TextBox12.Text
Sheet(i).Range("O65536").End(xlUp).Offset(1) = TextBox16.Text
Sheet(i).Range("R65536").End(xlUp).Offset(1) = TextBox13.Text
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox16.Text = ""
ComboBox1.Text = ""
End Sub
- Private Sub CommandButton1_Click()
- Dim i As Integer
- Dim j As Integer
- Dim sht As Worksheet
- If TextBox3.Value = "" Then
- MsgBox "厚度不能为空!!"
- ElseIf TextBox4.Value = "" Then
- MsgBox "长度不能为空!!"
- ElseIf TextBox5.Value = "" Then
- MsgBox "宽度不能为空!!"
- ElseIf TextBox6.Value = "" Then
- MsgBox "片数不能为空!!"
- ElseIf ComboBox1.Value = "" Then
- MsgBox "请选择包装方式!!"
- ElseIf TextBox16.Value = "" Then
- MsgBox "批次不能为空!!无批次请输入0!"
- ElseIf 班组选择.ComboBox1.Value = "第一生产线" Then
- one
- ElseIf 班组选择.ComboBox1.Value = "第二生产线" Then
- two
- ElseIf 班组选择.ComboBox1.Value = "第三生产线" And 班组选择.ComboBox4.Value = "普通白玻" Then
- Set sht = Sheet9
- ElseIf 班组选择.ComboBox1.Value = "第三生产线" And 班组选择.ComboBox4.Value = "超白玻璃" Then
- Set sht = Sheet7
- ElseIf 班组选择.ComboBox1.Value = "第四生产线" And 班组选择.ComboBox4.Value = "普通白玻" Then
- Set sht = Sheet8
- End If
- With sht.Range("A65536").End(xlUp)
- .Offset(1) = TextBox14.Text
- .Offset(1, 1) = TextBox1.Text
- .Offset(1, 2) = TextBox2.Text
- .Offset(1, 3) = TextBox3.Value
- .Offset(1, 4) = TextBox4.Value
- .Offset(1, 5) = TextBox5.Value
- .Offset(1, 6) = TextBox6.Text
- .Offset(1, 7) = ComboBox1.Text
- .Offset(1, 8) = IIf(TextBox7.Text = "", 0, TextBox7.Value)
- .Offset(1, 9) = IIf(TextBox8.Text = "", 0, TextBox8.Value)
- .Offset(1, 10) = IIf(TextBox9.Text = "", 0, TextBox9.Value)
- .Offset(1, 11) = IIf(TextBox10.Text = "", 0, TextBox10.Value)
- .Offset(1, 12) = IIf(TextBox11.Text = "", 0, TextBox11.Value)
- .Offset(1, 13) = IIf(TextBox12.Text = "", 0, TextBox12.Value)
- .Offset(1, 14) = TextBox16.Text
- .Offset(1, 17) = IIf(TextBox13.Text = "", "无", TextBox13.Value)
- End With
- TextBox3.Text = ""
- TextBox4.Text = ""
- TextBox5.Text = ""
- TextBox6.Text = ""
- TextBox7.Text = ""
- TextBox8.Text = ""
- TextBox9.Text = ""
- TextBox10.Text = ""
- TextBox11.Text = ""
- TextBox12.Text = ""
- TextBox16.Text = ""
- ComboBox1.Text = ""
- End Sub
复制代码
|
|