![]() |
VBA autofilter
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 |
VBA autofilter
Hi
"*Europe*" or Choice= "*" & Choice & "*" regards, Per "Pawan" skrev i meddelelsen ... 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 |
VBA autofilter
Hi Per..
That worked perfectly.. :-) Thanks Pawan "Per Jessen" wrote: Hi "*Europe*" or Choice= "*" & Choice & "*" regards, Per "Pawan" skrev i meddelelsen ... 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 |
All times are GMT +1. The time now is 06:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com