snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
If Range("L2:L11").Value < Range("M2:M11").Value Then
If MsgBox(" µéͧ¡Ò÷ӵèÍËÃ×ÍäÁè ", vbYesNo + vbQuestion + vbDefaultButton2, " Close and Save ") = 6 Then
Call Sample2
MsgBox "TOTAL NUMBER ERROR"
Exit Sub
End If
End If
'Other code
For Each Rng In Range("l2:l11")
If Rng.Value < Rng.offet(0, 1).Value Then
If MsgBox(" ต้องการทำต่อหรือไม่ ", vbYesNo + vbQuestion + vbDefaultButton2, " Close and Save ") = 6 Then
Call Sample2
MsgBox "TOTAL NUMBER ERROR"
Exit Sub
End If
End If
Next rmg
'Other code
ตรงนี้ครับต่อจาก sumif
Private Sub TextBox2_AfterUpdate()
If Me.TextBox2.Text = "" Then Exit Sub
emptyrow = WorksheetFunction.CountA(Range("A:A")) + 1
With Worksheets("Barcode")
If Me.TextBox2.Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Sheets("Barcode").Range("K2:N50"), Me.TextBox2.Value) = 0 Then
Call Sample2
'Me.TextBox2.Value = ""
MsgBox "Not found."
Exit Sub
End If
With Me
.TextBox4 = Application.WorksheetFunction.VLookup(CLng(Me.TextBox2), Sheets("Barcode").Range("K2:N50"), 4, 0)
End With
For Each Rng In Range("l2:l11")
If Rng.Value < Rng.offet(0, 1).Value Then
If MsgBox(" µéͧ¡Ò÷ӵèÍËÃ×ÍäËÁ ", vbYesNo + vbQuestion + vbDefaultButton2, " Close and Save ") = 6 Then
Call Sample2
MsgBox "TOTAL NUMBER ERROR"
Exit Sub
End If
End If
Next rmg
Dim strRowSource As String
With ListBox2
strRowSource = .RowSource
.RowSource = vbNullString
.RowSource = strRowSource
End With
Dim lsRow As Long
With Sheets("Barcode")
lsRow = .Range("a" & .Rows.Count).End(xlUp).Row
End With
ListBox1.RowSource = Sheets("Barcode").Range("A2:i" & lsRow).Address(external:=True)
With ListBox1
.ListIndex = .ListCount - 1
.Selected(.ListCount - 1) = True
End With
End With
End Sub