คลิกบันทึกข้อมูล แต่ไม่บันทึก
Posted: Mon Jan 01, 2018 5:29 pm
ผมเขียนCode ถูกหรือไม่ครับ
Codeที่ถูกต้องควรเขียนอย่างไรครับ
Private Sub CommandButton1_Click()
emptyRow = WorkcheetFunion.CountA(Range("B:B")) + 1
Cells(emptyRow, 1).Value = TextBox1.Value
Cells(emptyRow, 2).Value = TextBox2.Value
Cells(emptyRow, 3).Value = TextBox3.Value
Cells(emptyRow, 4).Value = TextBox4.Value
Cells(emptyRow, 5).Value = TextBox5.Value
Cells(emptyRow, 6).Value = TextBox6.Value
Cells(emptyRow, 7).Value = TextBox7.Value
Cells(emptyRow, 8).Value = TextBox8.Value
Cells(emptyRow, 9).Value = TextBox9.Value
Cells(emptyRow, 10).Value = TextBox10.Value
Cells(emptyRow, 11).Value = TextBox11.Value
Cells(emptyRow, 12).Value = TextBox12.Value
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Initiali()
TexBox1.Value = ""
TexBox2.Value = ""
TexBox3.Value = ""
TexBox4.Value = ""
TexBox5.Value = ""
TexBox6.Value = ""
TexBox7.Value = ""
TexBox8.Value = ""
TexBox9.Value = ""
TexBox10.Value = ""
TexBox11.Value = ""
TexBox12.Value = ""
End Sub
ขอบคุณล่วงหน้าครับ
Codeที่ถูกต้องควรเขียนอย่างไรครับ
Private Sub CommandButton1_Click()
emptyRow = WorkcheetFunion.CountA(Range("B:B")) + 1
Cells(emptyRow, 1).Value = TextBox1.Value
Cells(emptyRow, 2).Value = TextBox2.Value
Cells(emptyRow, 3).Value = TextBox3.Value
Cells(emptyRow, 4).Value = TextBox4.Value
Cells(emptyRow, 5).Value = TextBox5.Value
Cells(emptyRow, 6).Value = TextBox6.Value
Cells(emptyRow, 7).Value = TextBox7.Value
Cells(emptyRow, 8).Value = TextBox8.Value
Cells(emptyRow, 9).Value = TextBox9.Value
Cells(emptyRow, 10).Value = TextBox10.Value
Cells(emptyRow, 11).Value = TextBox11.Value
Cells(emptyRow, 12).Value = TextBox12.Value
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Initiali()
TexBox1.Value = ""
TexBox2.Value = ""
TexBox3.Value = ""
TexBox4.Value = ""
TexBox5.Value = ""
TexBox6.Value = ""
TexBox7.Value = ""
TexBox8.Value = ""
TexBox9.Value = ""
TexBox10.Value = ""
TexBox11.Value = ""
TexBox12.Value = ""
End Sub
ขอบคุณล่วงหน้าครับ