VBA autofilter

P

Pawan

I am writing a macro for autofilter. The code is (taken from one community):

Dim FiltRng As Range
Worksheets(Choice).Cells.ClearContents
rng.AutoFilter Field:=Field, Criteria1:=Choice
On Error Resume Next
Set FiltRng = rng.SpecialCells(xlCellTypeVisible).EntireRow
On Error GoTo 0
FiltRng.Copy Worksheets(Choice).Range("A1")
Set FiltRng = Nothing

This code is taking search string from userform.
It is working fine to search exact cell contents. However I want to search
the records even if that word is part of the cell. e.g. if I write "Europe"
then it should also search the cells which have "Europe" word, even if there
are additionals words in the cell.

How can we do this?

Thank You

Regards,
Pawan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top