Page 1 of 1

Code VBA Save ทับตำแหน่งเดิม

Posted: Tue Jun 06, 2017 5:34 pm
by dannyb11
รบกวนขอความรู้ครับ ผมสร้าง form ; edit_customer มาเพื่อค้นหาข้อมุลใน sheet ; customer_db
เมื่อเจอแล้วให้นำมาแสดงใน form ทำการแก้ไขข้อมูล และต้องการ save ข้อมูลที่แก้ทับลงไปในตำแหน่งเดิมใน sheet : customer_db
ปัญหาของผมคือ เรียกข้อมุลมาแก้ไขได้ แต่ save ไม่ได้ แก้ยังไงก็ไม่ออก ครับ


Public Sub save_mode2()

Dim save_row As Single

save_row = 8

Do Until Worksheets(db_sheet).Cells(save_row, 2).Value = CLng(edit_customer.customercode_txtbox.Value)


save_row = save_row + 1

Loop

With Worksheets(db_sheet)

.Cells(save_row, code_col).Value = edit_customer.customercode_txtbox.Value
.Cells(save_row, name_col).Value = edit_customer.customername_txtbox.Value
.Cells(save_row, address_col).Value = edit_customer.address_txtbox.Value
.Cells(save_row, id_col).Value = edit_customer.TaxID_txtbox.Value
.Cells(save_row, branch_col).Value = edit_customer.IDBranch_txtbox.Value


End With

MsgBox "ºÑ¹·Ö¡¢éÍÁÙÅÊÓàÃç¨", vbInformation, "Edit / á¡éä¢"

End Sub

Re: Code VBA Save ทับตำแหน่งเดิม

Posted: Tue Jun 06, 2017 11:09 pm
by snasui
:D ช่วยลำดับวิธีทดสอบ ค่าที่ต้องกรอก ผลลัพธ์ที่ถูกต้องที่ต้องการ จะได้สะดวกต่อการทดสอบ

สำหรับการโพสต์ Code ลงในฟอรัมเพื่อสะดวกต่อการอ่าน ให้ปฏิบัติตามกฎการใช้บอร์ดข้อ 5 ด้านบนครับ