- Worksheets("Summary").Range("Z2:BL2") isn't a string, so instr() won't work.
- the result of instr() is an integer, so in your case it doesn't test on being one of the values in the specified range.
to turn the range into a string:
c00=join(application.transpose(application.transpose(Worksheets("Summary").Range("Z2:BL2"))),"|")
now you can use
instr(CUST_ADDRESS.STATE,c00)>0
althought I can't test it, it would turn out to:
sSql = sSql & "AND ((CUSTOMER_ORDER.ORDER_DATE>{ts '2009-12-31 00:00:00'}) AND (CUST_ORDER_LINE.LAST_SHIPPED_DATE Is Null) AND instr( CUST_ADDRESS.STATE,'" & c00 & "')>0) ORDER BY CUSTOMER_ORDER.CUSTOMER_ID "
Bookmarks