tony.reynolds
Board Regular
- Joined
- Jul 8, 2010
- Messages
- 97
I have a userform with a multi select listbox.
however i would like to customize how it works
1. i would like to only allow one or two entries to be selected no more
a msgbox that says "you can only select one or two Dates" then clear the last selected would be great.
Below is the code so far that enters the forst selected date in Range("AvailableDates1") and then the next in next row down etc
anyone help me restrict the select operation to one or two only would be great
however i would like to customize how it works
1. i would like to only allow one or two entries to be selected no more
a msgbox that says "you can only select one or two Dates" then clear the last selected would be great.
Below is the code so far that enters the forst selected date in Range("AvailableDates1") and then the next in next row down etc
Code:
Private Sub CommandButton1_Click()
Dim i As Long, ACell As Range
Set ACell = Range("AvailableDates1")
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
ACell = ListBox1.List(i)
Set ACell = ACell.Offset(1, 0)
End If
Next i
End Sub
anyone help me restrict the select operation to one or two only would be great