Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofilter Criteria From a TextBox

I would like my prog retrieves from a worksheet based on what users
input in a textbox.

look_for = Workbooks("CONTRACT").Sheets("Advanced Find").Cells(9,
3).Value
Range("C3").AutoFilter Field:=3, Criteria1:=look_for, Operator:=xlAnd


Instead of having the exact look_for, I want the program to retrieve
any words contain from the look_for. Tried to use
Criteria1:="*look_for*" but the program will certainly filter for
words look_for.

  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Autofilter Criteria From a TextBox

Hi Farah -

Convert the look_for variable into a valid criterion for the Autofilter's
Criteria1 argument: look_for = "=*" & look_for & "*".

look_for = Workbooks("CONTRACT").Sheets("Advanced Find").Cells(9,
3).Value
look_for = "=*" & look_for & "*".
Range("C3").AutoFilter Field:=3, Criteria1:=look_for, Operator:=xlAnd

--
Jay


" wrote:

I would like my prog retrieves from a worksheet based on what users
input in a textbox.

look_for = Workbooks("CONTRACT").Sheets("Advanced Find").Cells(9,
3).Value
Range("C3").AutoFilter Field:=3, Criteria1:=look_for, Operator:=xlAnd


Instead of having the exact look_for, I want the program to retrieve
any words contain from the look_for. Tried to use
Criteria1:="*look_for*" but the program will certainly filter for
words look_for.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selection.AutoFilter Field / Criteria = criteria sometimes non-existing on worksheet markx Excel Programming 1 November 24th 06 02:52 PM
AutoFilter criteria Mark Excel Programming 1 November 2nd 05 12:08 PM
AutoFilter Criteria VBA EstherJ Excel Programming 2 August 20th 04 12:54 PM
Using TextBox to AutoFilter salihyil Excel Programming 4 February 16th 04 04:57 PM
VBA Autofilter Criteria Brandon[_5_] Excel Programming 1 November 7th 03 12:40 PM


All times are GMT +1. The time now is 03:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"