แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1
Posted: Mon Nov 25, 2013 7:42 pm
อาจารย์คับ ผมต้องการ ให้มันแสดง ใน
ชีท "หน้าแรก" ใน ListBox1 ด้วย และใน
ชีท "รายการสินค้า" ด้วย
ชีท "หน้าแรก" ใน ListBox1 ด้วย และใน
ชีท "รายการสินค้า" ด้วย
Code: Select all
Private Sub CommandButton1_Click()
Row = 1
Do
Row = Row + 1
Loop Until Worksheets("รายการสินค้า").Cells(Row, 1) = ""
Worksheets("รายการสินค้า").Cells(Row, 1) = TextBox1
TextBox1 = ""
If OptionButton1.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton1.Caption
Else
If OptionButton2.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton2.Caption
End If
If OptionButton3.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton3.Caption
End If
If OptionButton4.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton4.Caption
End If
If OptionButton5.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton5.Caption
End If
If OptionButton6.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton6.Caption
End If
If OptionButton7.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton7.Caption
End If
If OptionButton8.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton8.Caption
End If
If OptionButton9.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton9.Caption
End If
If OptionButton10.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton10.Caption
End If
If OptionButton11.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton11.Caption
End If
If OptionButton12.Value Then
Worksheets("รายการสินค้า").Cells(Row, 2) = OptionButton12.Caption
End If
End If
OptionButton1.Value = 0
OptionButton2.Value = 0
OptionButton3.Value = 0
OptionButton4.Value = 0
OptionButton5.Value = 0
OptionButton6.Value = 0
OptionButton7.Value = 0
OptionButton8.Value = 0
OptionButton9.Value = 0
OptionButton10.Value = 0
OptionButton11.Value = 0
OptionButton12.Value = 0
Worksheets("รายการสินค้า").Cells(Row, 3) = ComboBox1
ComboBox1 = ""
Worksheets("รายการสินค้า").Cells(Row, 4) = ComboBox3
ComboBox3 = ""
Worksheets("รายการสินค้า").Cells(Row, 5) = TextBox3.Value
TextBox3 = ""
Worksheets("รายการสินค้า").Cells(Row, 6) = Now()
Worksheets("รายการสินค้า").Cells(Row, 7) = Now()
Worksheets("หน้าแรก").Cells (ListBox1)
End Sub