snasui wrote:
กรุณาอ่านที่ผมโพสต์และแจ้งมาตามนั้นให้ครบถ้วนทุกข้อความที่ผมเขียนแจ้งไป โดยเขียนมาในช่องความเห็นนี้ด้วยครับ
Code: Select all
Private Sub btsave_Click()
On Error Resume Next
If TextBox1 = "" Or TextBox3 = "" Then
MsgBox "กรุณากรอกข้อมูลให้ครบถ้วน"
Exit Sub
End If
Dim emptyRow As Integer
Dim ct As Object
Dim strTb1 As Variant
Dim strTb3 As Variant
For Each ct In Me.Frame2.Controls
If VBA.Left(ct.Name, 3) = "Opt" And ct.Value = True Then
Debug.Print ct.Name
Cells(emptyRow, 7).Value = ct.Caption
Exit For
End If
Next ct
For Each ct In Me.Frame5.Controls
If VBA.Left(ct.Name, 4) = "Opt" And ct.Value = True Then
Debug.Print ct.Name
Cells(emptyRow, 8).Value = ct.Caption
Exit For
End If
Next ct
emptyRow = WorksheetFunction.CountA(Sheet9.Range("A3:A10000")) + 1
'emptyRow = WorksheetFunction.Count("A3:A10000") + 1
If emptyRow = 0 Then
emptyRow = 2
Else
emptyRow = emptyRow + 2
Sheet9.Activate
strTb1 = Split(TextBox1.Text, vbCrLf)
strTb3 = TextBox3.Text & vbCrLf
strTb3 = strTb3 & vbCrLf
strTb3 = strTb3 & vbCrLf
strTb3 = Split(strTb3, vbCrLf)
Cells(emptyRow, 1).Value = VBA.Mid(strTb1(0), InStr(strTb1(0), ":") + 1) 'TextBox1.Value
Cells(emptyRow, 2).Value = VBA.Mid(strTb1(1), InStr(strTb1(1), ":") + 1) 'TextBox1.Value
Cells(emptyRow, 3).Value = VBA.Mid(strTb1(2), InStr(strTb1(2), ":") + 1) 'TextBox1.Value
Cells(emptyRow, 4).Value = VBA.Mid(strTb1(3), InStr(strTb1(3), ":") + 1) 'TextBox1.Value
Cells(emptyRow, 6).Value = strTb3(0) & "," & strTb3(1) & "," & strTb3(2) & vbCrLf & strTb3(3) & "," & strTb3(4) & "," & strTb3(5) 'TextBox3.Value
'Cells(emptyRow, 7).Value = OptionButton
Cells(emptyRow, 5).Value = comday.Value & "/" & commonth.Value & "/" & comyear.Value
MsgBox "บันทึกข้อมูลเรียบร้อยแล้ว"
Unload Me
UserForm1.Show
End If
Sheet1.Activate
End Sub

เมื่อเลือกข้อมูลใน option button ในส่วนของ Reason แล้วพอกดปุ่มบันทึกให้ข้อมูลถูกบันทึกลงในคอลลัมน์ Reason ในชีทการเบิกค่ะ

เมื่อเลือกข้อมูลใน option button ในส่วนของ Status แล้วพอกดปุ่มบันทึกให้ข้อมูลถูกบันทึกลงในคอลลัมน์ Status ในชีทการเบิกค่ะ
ปัญหาที่แจ้งอยู่ที่ UserForm1 ค่ะ

You do not have the required permissions to view the files attached to this post.