snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub CobBox15_Change()
Dim i As Integer
If CobBox16.ListCount > 1 Then
For i = CobBox16.ListCount To 1 Step -1
CobBox16.RemoveItem i - 1
Next i
End If
Range("K6").Select
CobBox16.Text = ""
Do While Not IsEmpty(ActiveCell.Value)
If CDate(ActiveCell.Value) >= CDate(CobBox15.Text) Then
CobBox16.AddItem ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Private Sub CobBox16_Change()
Dim i As Integer
If CobBox21.ListCount > 1 Then
For i = CobBox21.ListCount To 1 Step -1
CobBox21.RemoveItem i - 1
Next i
End If
CobBox21.Text = ""
Range("K6").Select
If CobBox16 = "" Then Exit Sub
Do While Not IsEmpty(ActiveCell.Value)
If CDate(ActiveCell.Value) >= CDate(CobBox15.Text) And _
CDate(ActiveCell.Value) <= CDate(CobBox16.Text) Then
CobBox21.AddItem ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub