ผมเขียนโค๊ดเพื่อให้ Excel แจ้งเตือนในรูปแบบของ MsgBox ตามเงื่อนไขที่กำหนด ซึ่งโค๊ดตรวจสอบพบข้อมูลตรงตามเงื่อนไข 10 รายการ
แต่ MsgBox แสดงข้อมูลแค่ 9 รายการ โดยที่รายการที่ 10 แสดงแต่ดูเหมือนพื้นที่การแสดงผลไม่พอ จึงอยากทราบว่า MsgBox มีการจำกัด
ข้อมูลในการแสดงผลหรือไม่ หรือโค๊ดที่ผมเขียนผิดพลาดตรงจุดไหน ฝากท่านผู้รู้ช่วยตรวจสอบด้วยครับ
Code: Select all
Public tbl As ListObject
Function GetTableData(projRow)
projFastwork = tbl.DataBodyRange.Cells(projRow, tbl.ListColumns(" ค้างส่งปัจจุบัน").Index)
projOrder = tbl.DataBodyRange.Cells(projRow, tbl.ListColumns("เลขที่ออร์เดอร์").Index)
projInfo = tbl.DataBodyRange.Cells(projRow, tbl.ListColumns("รายละเอียด").Index)
projFullMsg = " | " & projOrder & " | " & projInfo & " | " & "จน. " & projFastwork & " ผืน"
GetTableData = projFullMsg
End Function
Sub LoopTable()
Set tbl = ActiveSheet.ListObjects("Table5")
'get current date
dateToday = Date
'check number of Rows
NumRows = tbl.DataBodyRange.Rows.Count
'Due Already
CountDue = 0
For i = 1 To NumRows
projFastwork = tbl.DataBodyRange.Cells(i, tbl.ListColumns(" ค้างส่งปัจจุบัน").Index)
projNum = tbl.DataBodyRange.Cells(i, tbl.ListColumns(" ผืนจริง3").Index)
projInfo = tbl.DataBodyRange.Cells(i, tbl.ListColumns("รายละเอียด").Index)
If projFastwork > 0 And projNum <> 0 And projInfo <> 0 Then
DueMsg = DueMsg & GetTableData(i) & Chr(13) & Chr(10)
CountDue = CountDue + 1
End If
Next i
MsgBox "ใกล้ปิดLot แล้ว : " & CountDue & " รายการ" & Chr(13) & Chr(10) & DueMsg
'If CountDue > 0 Then
' Call LineNotify("อย่าลืมจ่ายกันเด้อพี่น้อง", 118, 1)
'End If
End Sub
โค๊ดอยู่ใน Module2 ในไฟล์ที่แนบครับ
You do not have the required permissions to view the files attached to this post.