Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code that works:
Selection.AutoFilter Field:=3, Criteria1:="GMT001(2)" I want to be able to do something like: Selection.AutoFilter Field:="Car Model", Criteria1:="GMT001(2)" Eventually the "Car Model" would be assigned a variable of Text Type. Any suggestions on how I could do this? If there's no silver bullet, is there a property or something that I could latch on to that has the list of Index'd Column Titles or at least the far left cell address to offset from? Thanks, MikeZz |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The autofilter is already applied to the correct range?
If yes: Option Explicit Sub testme01() Dim myCell As Range Dim res As Variant Dim myTitle As String Dim myCrit As String myTitle = "Car Model" myCrit = "gmt001(2)" With Worksheets("sheet1").AutoFilter.Range res = Application.Match(myTitle, .Rows(1), 0) If IsError(res) Then 'no cell with that value 'do nothing Else .AutoFilter field:=res, Criteria1:=myCrit End If End With End Sub MikeZz wrote: I have the following code that works: Selection.AutoFilter Field:=3, Criteria1:="GMT001(2)" I want to be able to do something like: Selection.AutoFilter Field:="Car Model", Criteria1:="GMT001(2)" Eventually the "Car Model" would be assigned a variable of Text Type. Any suggestions on how I could do this? If there's no silver bullet, is there a property or something that I could latch on to that has the list of Index'd Column Titles or at least the far left cell address to offset from? Thanks, MikeZz -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Chart Title Using Autofilter Selection | Charts and Charting in Excel | |||
Apply autofilter selections to 2nd table automatically? Macro? | Excel Worksheet Functions | |||
Named range=Column title,comumn title in cellB6 use B6in equation | Excel Discussion (Misc queries) | |||
apply autofilter to more than one table | Excel Worksheet Functions | |||
Possible to apply Autofilter to a subset of available columns? | Excel Discussion (Misc queries) |