fatboyfatter
Technical User
HELP!,
As they say a little knowledge is dangerous, so I need you guys to put me right!
I am trying to automate a filter using macros.
I have set a cell vaue as the FNVARIABLE, this will alwys be an alpha string contained in a title string in a cell
Example 54321A BRKT LH MLDG OTR.
I may wan to find in a list all lines containg BRKT.
I want to use a cell say $A$1 as the input criteria and then autofilter the list blah blah blah!
This is the code I have so far used, when tring to set the autofilter criteria the coding uses an absolute and not the variable I need it to be. when viewing the resultant filter it alwys defaults to "EQUALS" I need it to be "CONTAINS"
Any suggestions?
CODE:
Dim FNVARIABLE
FNVARIABLE = Worksheets("sheet1").Range("A1").Value
Sheets("sheet2)").Select
Columns("c:c").Select
Selection.Copy
Sheets("Sheet3").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFilter Field:=3, Criteria1:=FNVARIABLE, Operator:=xlAnd, _
Criteria2:=FNVARIABLE
As they say a little knowledge is dangerous, so I need you guys to put me right!
I am trying to automate a filter using macros.
I have set a cell vaue as the FNVARIABLE, this will alwys be an alpha string contained in a title string in a cell
Example 54321A BRKT LH MLDG OTR.
I may wan to find in a list all lines containg BRKT.
I want to use a cell say $A$1 as the input criteria and then autofilter the list blah blah blah!
This is the code I have so far used, when tring to set the autofilter criteria the coding uses an absolute and not the variable I need it to be. when viewing the resultant filter it alwys defaults to "EQUALS" I need it to be "CONTAINS"
Any suggestions?
CODE:
Dim FNVARIABLE
FNVARIABLE = Worksheets("sheet1").Range("A1").Value
Sheets("sheet2)").Select
Columns("c:c").Select
Selection.Copy
Sheets("Sheet3").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.AutoFilter Field:=3, Criteria1:=FNVARIABLE, Operator:=xlAnd, _
Criteria2:=FNVARIABLE