I have created a userform that uses 3 dependent comboboxes to calculate the price of a tour. Once I have filtered through the levels, I am then trying to pull in that tour's specific data such as prices. The program I have works though only up to a point. After I increase the number of objects added to the for loop in combobox3 past 8 objects, I get an error of "Method 'Range' of the object '_Global' non riuscito".
I am using 3 scripted dictionaries for the CB filtering:
There error is in here:
Private Sub ComboBox3_Change()
If ComboBox1 <> "" And ComboBox2 <> "" Then
If ComboBox3.ListIndex = -1 And IsError(Application.Match(ComboBox3, Tour, 0)) Then
Set SD = CreateObject("Scripting.Dictionary")
bul = UCase(ComboBox3) & "*"
For Each c In tablo3
If c Like bul Then SD(c) = ""
Next c
ComboBox3.List = SD.keys
ComboBox3.DropDown
Else
ara_1 = ComboBox1.Text
ara_2 = ComboBox2.Text
ara_3 = ComboBox3.Value
For i = LBound(Tour) To UBound(Tour)
If CustType(i) = ara_1 And Prototype(i) = ara_2 And Tour(i) = ara_3 Then
TextBox1.Value = Code(i)
ComboBox10.Text = MeetingPoint1(i)
ComboBox12.Text = MeetingPoint2(i)
TextBox20.Value = Duration(i)
TextBox9.Value = Tier1(i)
TextBox10.Value = Price1(i)
TextBox11.Value = Tier2(i)
TextBox12.Value = Price2(i)
TextBox21.Value = Tier3(i)
TextBox22.Value = Price3(i)
End If
Next i
TextBox2.SetFocus
If Val(Application.Version) > 10 Then SendKeys "{f4}"
End If
ComboBox3.BackColor = &H80FFFF
End If
End Sub
I am using 3 scripted dictionaries for the CB filtering:
There error is in here:
Private Sub ComboBox3_Change()
If ComboBox1 <> "" And ComboBox2 <> "" Then
If ComboBox3.ListIndex = -1 And IsError(Application.Match(ComboBox3, Tour, 0)) Then
Set SD = CreateObject("Scripting.Dictionary")
bul = UCase(ComboBox3) & "*"
For Each c In tablo3
If c Like bul Then SD(c) = ""
Next c
ComboBox3.List = SD.keys
ComboBox3.DropDown
Else
ara_1 = ComboBox1.Text
ara_2 = ComboBox2.Text
ara_3 = ComboBox3.Value
For i = LBound(Tour) To UBound(Tour)
If CustType(i) = ara_1 And Prototype(i) = ara_2 And Tour(i) = ara_3 Then
TextBox1.Value = Code(i)
ComboBox10.Text = MeetingPoint1(i)
ComboBox12.Text = MeetingPoint2(i)
TextBox20.Value = Duration(i)
TextBox9.Value = Tier1(i)
TextBox10.Value = Price1(i)
TextBox11.Value = Tier2(i)
TextBox12.Value = Price2(i)
TextBox21.Value = Tier3(i)
TextBox22.Value = Price3(i)
End If
Next i
TextBox2.SetFocus
If Val(Application.Version) > 10 Then SendKeys "{f4}"
End If
ComboBox3.BackColor = &H80FFFF
End If
End Sub