Dependent ComboBoxes as Critiria for VLOOKUP or OFFSET
Hey Corey,
Thanks for the reply.
I can't seem to find any points of reference between what I am looking
for and your code. I'm not even sure what your code is doing.
As I mentioned earlier, I have 3 ComboBoxes (CB1, CB2 & CB3) and 2
TextBoxes (TB5 & TB6). These are on a UserForm.
In the workbook are two sheets (Enter & Data)I start the UserForm from
Enter and sore the imputed data on Data. On the UserForm, I am trying
to find which row on the data sheet matches up with a set of criteria
containing three items (Vendor, Date/Time & Item number) and move over
to columns E & F to pick up misc 1 & misc 3 information and place this
info into TB5 & TB6..
I have a sample workbook, which shows the problem, that I can email or
FTP to anyone. It is about 63 K after zipping.
Thanks again for your reply.
-Minitman
On Fri, 7 Jul 2006 08:37:47 +1000, "Corey"
wrote:
Minitman,
Try the below codes
It works for me, thanks to Mike.
I think it is what you need also.
CHANGE the ComboBox numbers etc to suit.
Corey....
Private Sub UserForm_Activate()
Dim i As Integer, j As Integer
Dim addit As Boolean, addit2 As Boolean
ComboBox3.Clear
For Each wks In Worksheets
addit = True
For i = 0 To ComboBox3.ListCount - 1
If ComboBox3.ListCount = 0 Then Exit For
If wks.Range("B3").Text = ComboBox3.List(i) Then addit = False Next i
If addit Then ComboBox3.AddItem wks.Range("B3").Text
Next wks
End Sub
Private Sub ComboBox3_Change() ComboBox4.Clear For Each wks In Worksheets
If wks.Range("b3").Text = ComboBox3.Value Then addit2 = True
For j = 0 To ComboBox4.ListCount - 1
If ComboBox4.ListCount = 0 Then Exit For
If wks.Range("D3").Text = ComboBox4.List(j) Then addit2 = False
Next j
If addit2 Then ComboBox4.AddItem wks.Range("D3").Text End If
Next wks
End Sub
Private Sub Combobox4_Change() Dim combolist
If ComboBox4.ListCount = 0 Then Exit Sub
For Each wks In Worksheets
If wks.Range("B3") = ComboBox3.Value And wks.Range("D3") = _
ComboBox4.Value Then combolist = combolist & wks.Name & Chr(10)
Next wks
' MsgBox (combolist)
End Sub
Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub
|