Guys,
I'm trying to write a macro that will custom filter a column for cells containing the value in a cell, the macro I have so far is:
Sub Filter()
ActiveSheet.AutoFilterMode = off
LookupVal = Range("C3")
Range("A8").AutoFilter Field:=4, Criterial:=LookupVal
End Sub
However that only returns cells that are equal to C3, normally to do contains I would put "* *" around the value but then that removes the reference to cell C3, any ideas how to combine the two?
Last edited by Stuart2; 06-09-2009 at 09:30 AM.
Try with this code:
Regards,Code:Sub Filter() ActiveSheet.AutoFilterMode = off LookupVal = Range("C3") Range("A8").AutoFilter Field:=4, Criterial:="=*" & LookupVal & "*" End Sub
Antonio
Works brilliantly, thanks so much.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks