By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

How to perform validation on multiple combo boxes?

P: 1
Hi Guys,

I have a form with 48 Combo Boxes on it and I am filling them from the same range.
I want to remove the values that are already selected not be available in the next ComboBox.
I have tried many ways to make it work but i couldn't. Probably the problem is because I initialize all the ComboBox values in the beginning and if i want to remove a value i need some kind of event.
Here is my Intialization code:

Expand|Select|Wrap|Line Numbers
  1. Public Sub UserForm_Initialize()
  2. Dim cLoc As Range
  3. Dim ws As Worksheet
  4. Dim combo As String
  5. Dim i As Integer
  7. For i = 1 To 48
  8.     combo = "ComboBox" & CStr(i) '48 ComboBoxes on the Form
  9.     Set ws = Worksheets("Calc")
  10.         For Each cLoc In ws.Range("Stops") 'Range to fill the ComboBoxes values
  11.           With Me.Controls(combo)
  12.             .AddItem cLoc.Value
  13.             .List(.ListCount - 1, 1) = cLoc.Offset(0, 1).Value 'Adding second column
  14.           End With
  15.         Next cLoc
  16. Next i
  18. End Sub
Thanks in Advance.
Feb 10 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.