Page 1 of 1

แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 7:42 pm
by ponhuahin
อาจารย์คับ ผมต้องการ ให้มันแสดง ใน
ชีท "หน้าแรก" ใน 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

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 7:44 pm
by ponhuahin
ลืมแนบไฟล์คับ

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 9:17 pm
by snasui
ponhuahin wrote:อาจารย์คับ ผมต้องการ ให้มันแสดง ใน
ชีท "หน้าแรก" ใน ListBox1 ด้วย และใน
ชีท "รายการสินค้า" ด้วย
ponhuahin wrote:ลืมแนบไฟล์คับ
:D อ่านกฎข้อ 1 ด้านบนแล้วแก้ไขข้อความด้วย ย้ำว่าต้องแก้ ถ้าแก้ไม่ได้เนืองจากเลยเวลาที่กำหนดให้โพสต์ใหม่ให้ถูกต้องครับ

สำหรับที่ถามมานั้นช่วยอธิบายให้ละเอียดว่าต้องการให้ข้อมูลใดไปแสดงที่ใด ชีทหน้าแรกที่จะเอาไปไว้ใน ListBox1 คือข้อมุูลใดครับ :?:

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 9:35 pm
by ponhuahin
ขอโทษจริงๆครับอาจารย์ แก้ไม่ได้แล้วครับ ผมต้องตั้ง กระทู้ใหม่ หรือเปล่าครับ

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 9:40 pm
by snasui
:D เขียนคำถามใหม่ด้วยความระมัดระวังอย่าเผลอใช้ภาษาแชท อธิบายให้ละเอียดว่าต้องการจะทำอะไร ปัญหาคืออะไร ต้องการคำตอบเป็นอย่างไร โดยโพสต์ต่อในกระทู้นี้ได้เลย ระบุวิธีทดสอบมาด้วยเพื่อจะได้เข้าใจตรงกันสามารถเข้าถึงปัญหาได้โดยไวครับ

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Mon Nov 25, 2013 9:50 pm
by ponhuahin
ผมต้องการ ให้ข้อมูลที่เรากรอก ในฟอร์ม มาแสดง ใน
ชีท "หน้าแรก" ในชีทหน้าแรกนี้ผมสร้าง ListBox1 ไว้ด้วย เพื่อแสดงข้อมูลที่เรากรอกในวันนั้นนั้น
พอบันทึกหรือปิดไป ข้อมูลใน ListBox1 จะหายไป
และผมต้องการให้แสดงข้อมูลที่ ผมกรอกในฟอร์ม เข้าไปใน
ชีท "รายการสินค้า" นี้ด้วย

ผมใส่ข้อมูลลงให้ ชีท "รายการสินค้า" ได้แต่ ลงใน ListBox1 ที่อยู่ใน ชีท "หน้าแรก" ไม่ได้ครับ

Re: แสดงข้อมูลในฟอม ในชีท 2 และ ListBox1 ในชีท 1

Posted: Tue Nov 26, 2013 11:28 am
by snasui
:D Code ที่เขียนให้บันทึกรายการใน ListBox ในหน้าแรกเขียนไว้แล้วยัง ชือ Procedure ว่าอะไร ติดบรรทัดใดครับ