K
KR
I have three comboboxes on a worksheet that I pull values from. Each one has
a value of "All", followed by a list of items:
List 1:
All
Dog
Cat
Horse
etc.
I set a variable equal to each of the three combobox values (V1 ="Dog", V2 =
"Blue", V3 = "Pizza")
Now I need to loop through lines in a worksheet and check to see when
columns A, C, and D are equal to the individual info from the three
comboboxes. This is easy when I have specific values to match ("Dog") but
when I try to code for the "All" category I end up with a whole boatload of
embedded loops that end up confusing me and not working properly.
Essentially my original code looked something like:
If MyRange1 = V1 then
If MyRange2 = V2 then
If MyRange3 = V3 then
'do stuff
End if
End if
End if
If any selection is "All" I want to just skip that 'If' and keep going to
the next embedded if, rather than skipping over the whole section of code. I
looked at wildcards, but "Dog" isn't the same as "*", so that didn't work as
I'd hoped.
What would be the best approach to accept any MyRange value when my
comparison is "All"?
Many thanks in advance,
Keith
a value of "All", followed by a list of items:
List 1:
All
Dog
Cat
Horse
etc.
I set a variable equal to each of the three combobox values (V1 ="Dog", V2 =
"Blue", V3 = "Pizza")
Now I need to loop through lines in a worksheet and check to see when
columns A, C, and D are equal to the individual info from the three
comboboxes. This is easy when I have specific values to match ("Dog") but
when I try to code for the "All" category I end up with a whole boatload of
embedded loops that end up confusing me and not working properly.
Essentially my original code looked something like:
If MyRange1 = V1 then
If MyRange2 = V2 then
If MyRange3 = V3 then
'do stuff
End if
End if
End if
If any selection is "All" I want to just skip that 'If' and keep going to
the next embedded if, rather than skipping over the whole section of code. I
looked at wildcards, but "Dog" isn't the same as "*", so that didn't work as
I'd hoped.
What would be the best approach to accept any MyRange value when my
comparison is "All"?
Many thanks in advance,
Keith