'This might get you by
Option Explicit
Dim i As Integer
Dim chkcount As Integer
Dim iCheck As Integer
Dim condo As String
Dim countStr As String
Dim chkArray() As Integer
Private Sub Command1_Click()
Labelorder = ""
condo = ""
Lstcondo.ListIndex = 0
For i = 0 To Lstcondo.ListCount - 1
If chkcount = 0 Then GoTo errorhandler
If Lstcondo.ListIndex = 0 Then '1st item
If chkArray(i) = 1 Then condo = Lstcondo 'is checked, start building sentence
End If
If Lstcondo.ListIndex = 1 Then '2nd item & 3rd items
If chkArray(i) = 1 Then 'is checked
If condo = "" Then
condo = Lstcondo
ElseIf chkcount > 2 Then
condo = condo & ", " & Lstcondo
Else
condo = condo & " and " & Lstcondo
End If
End If
End If
If Lstcondo.ListIndex = 2 Then '3rd item
If chkArray(i) = 1 Then 'is checked
If condo = "" Then
condo = Lstcondo
ElseIf chkcount > 2 Then
condo = condo & ", " & Lstcondo
Else
condo = condo & " and " & Lstcondo
End If
End If
End If
If Lstcondo.ListIndex = 3 Then '4th item
If chkArray(i) = 1 Then 'is checked
If condo = "" Then
condo = Lstcondo
Else
condo = condo & " and " & Lstcondo
End If
End If
End If
If Lstcondo.ListIndex < Lstcondo.ListCount - 1 Then 'avoid going past end of listindex
Lstcondo.ListIndex = Lstcondo.ListIndex + 1
End If
Next
condo = condo & " ."
errorhandler: 'in case nothing selected
If chkcount = 0 Then
Labelorder = "No Condiments ordered."
Else
Labelorder = "You ordered a sandwich with " & condo
End If
End Sub
Private Sub Form_Load()
With Lstcondo
.AddItem "ketchup"
.AddItem "mustard"
.AddItem "relish"
.AddItem "mayo"
End With
End Sub
Private Sub Lstcondo_ItemCheck(Item As Integer)
chkcount = 0 'start count of chks with 0
iCheck = Lstcondo.ListCount - 1
ReDim Preserve chkArray(iCheck)
If chkArray(Item) = 0 Then 'are list items checked?
chkArray(Item) = 1
Else
chkArray(Item) = 0
End If
For i = 0 To Lstcondo.ListCount - 1
If chkArray(i) = 1 Then
chkcount = chkcount + 1 'How many?
End If
Next
End Sub