snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub cbPhase_Change()
Dim myCell As Range
Dim rngItems As Range
Set rngItems = Sheet6.ListObjects("tbAllChecklist").ListColumns(6).DataBodyRange.Value
Me.lbInitializeLeft.Clear
Me.lbInitializeRightClear
With Me.lbInitializeLeft
.LinkedCell = ""
.ListFillRange = ""
For Each myCell In rngItems.Cells
If Trim(myCell) <> "" Then
.AddItem myCell.Value
End If
Next myCell
End With
Me.lbInitializeLeft.MultiSelect = fmMultiSelectMulti
Me.lbInitializeRight.MultiSelect = fmMultiSelectMulti
End Sub
You do not have the required permissions to view the files attached to this post.
'Other code
Dim processCode As String
Set rngItems = Sheet6.ListObjects("tbAllChecklist").ListColumns(5).DataBodyRange
Me.lbInitializeRight.Clear
Me.lbInitializeLeft.Clear
With Me.lbInitializeLeft
' .LinkedCell = ""
' .ListFillRange = ""
For Each myCell In rngItems.Cells
processCode = Application.WorksheetFunction.VLookup(cbProcess.Value, _
Sheet7.ListObjects("tbProcessName").Range, 2, False)
If Trim(myCell.Value) <> "" Then
If myCell.Offset(0, -4).Value = processCode And _
myCell.Offset(0, -2).Text = Me.cbPhase.Text Then
.AddItem myCell.Value
End If
End If
Next myCell
End With
'Other code