Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter Macro with Cell reference
Hi there, I'm having an issue with recording a macro for custom filter with cell references. The macro doesn't record a generic reference, just the cell value at the time of recording. I looked loooong and hard for the solution here, but i just can't find it. The closest i have to the answer i found here (courtsey Tom Ogilvy):- Selection.AutoFilter Field:=1, Criteria1:="=*" & Range("M13").Value _ & "*" I tried playing around with the above but come unstuck when trying to do a less than or equals to. I desperately need help to this solution to finish off a project before the weekend's out. Please, please please with extra whipped cream help. Chris P.s could someone explain what the * element of the code is for? -- chris100 ------------------------------------------------------------------------ chris100's Profile: http://www.excelforum.com/member.php...o&userid=25166 View this thread: http://www.excelforum.com/showthread...hreadid=557087 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter Macro with Cell reference
Dnia Thu, 29 Jun 2006 14:50:30 -0500, chris100 napisał(a):
[...] Selection.AutoFilter Field:=1, Criteria1:="=*" & Range("M13").Value _ & "*" I tried playing around with the above but come unstuck when trying to do a less than or equals to. Selection.AutoFilter Field:=1, Criteria1:="<=" & Range("M13").Value [...] P.s could someone explain what the * element of the code is for? Look at this code: Criteria1:="=*" & Range("M13").Value & "*" If M13 equals to, let's say, "xyz", then this line expands to: Criteria1:="=*xyz*" which means "show all records that CONTAIN xyz in field 1" In the same way you could write: Criteria1:="=" & Range("M13").Value & "*" whicg means: all records BEGINNING with xyz in field 1 etc, etc... -- PL |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter Macro with Cell reference
Thanks Piotr, Meant to post and say that it worked. Appreciate the reply. Chris -- chris100 ------------------------------------------------------------------------ chris100's Profile: http://www.excelforum.com/member.php...o&userid=25166 View this thread: http://www.excelforum.com/showthread...hreadid=557087 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
reference cell from advanced filter | Excel Worksheet Functions | |||
Filter and show data based on a reference cell | Excel Worksheet Functions | |||
Cell reference in the auto filter custom list | Excel Discussion (Misc queries) | |||
Macro cell reference help | Excel Programming | |||
Microsoft Query - how to reference a cell value in a filter | Excel Programming |