sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I'm using this to populate a number of Comboboxes on a Userform;
The idea is that as each item is selected from any of the Comboboxes it is removed from the Named Range by another macro, (so that the remaining Comboboxes are only loaded with available staff). The problem I now have is when the last item is selected from that Named Range, this is producing an error as each of the other Comboboxes can't be loaded because there is nothing left.
Can anyone show me how to incorporate a method that won't produce an error if there is nothing in the Named Range?
Code:
For i = 1 To 24
Set ws = Worksheets("ResourcesNew")
If Me.Controls("ComboStaff" & i).Value <> "" Then
Else
Me.Controls("ComboStaff" & i).List = ws.Range("NewAvailableStaff").Value
End If
Next i
The idea is that as each item is selected from any of the Comboboxes it is removed from the Named Range by another macro, (so that the remaining Comboboxes are only loaded with available staff). The problem I now have is when the last item is selected from that Named Range, this is producing an error as each of the other Comboboxes can't be loaded because there is nothing left.
Can anyone show me how to incorporate a method that won't produce an error if there is nothing in the Named Range?