Hi Kevin,
If you look up
concatenation in Help you should find information on the two concatenation operators (& and +).
As for the two equal signs, they refer to different things ...
Criteria1 is a parameter passed to the autofilter. The way to tell the autofilter about it is by saying that Criteria1 is equal to something, i.e.
[tt] Criteria1[/tt][red][tt]:=[/tt][/red][tt]something[/tt].
This
something is the criterion for the autofilter; you want to select all cells with a value beginning with, in this case, your variable, partlookup. In other words all cells where:
[tt] cellvalue=partlookup*[/tt].
When specified as a criterion, the
cellvalue is implied and all that needs specifying is:
[tt] =partlookup*[/tt].
The comparison string is composed of two literals ("=" and "*") and a variable which needs to be substituted by VBA for the actual value before passing the complete string to Excel. To make sure VBA interprets it like this you concatenate (using &) the separate elements with the literals in quotes and the variable without:
[tt] "=" & partlookup & "*"[/tt].
So, the first equals sign is saying that Criteria1 is equal to something and the second one is part of the criteria, saying that the cell value must be equal to something, hence:
[tt] Criteria1[/tt][red][tt]:=[/tt][/red][tt] "[/tt][blue][tt]=[/tt][/blue][tt]" & partlookup & "*"[/tt].
Enjoy,
Tony
--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[