ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA auto filter question (https://www.excelbanter.com/excel-programming/318801-vba-auto-filter-question.html)

Andre Croteau

VBA auto filter question
 
Hi,

I have data in cells A3:C200, with the auto filter ON

I am trying to automate some procedures, and would like to put a value in
cell say "A1" which would represent the auto filter query I am looking for
column "C"

so far I have tried

Dim WSCode As String
WSCode = Worksheets("Sheet1").Cells(1, 1).Value
Selection.AutoFilter Field:=3, Criteria1:="WSCode"


but it doesn't work....

Can someone please give me a hand?

Thanks

André



Nick Hodge

VBA auto filter question
 
Andre

Off to test but it should work if you take the quotes from around the
variable

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Andre Croteau" wrote in message
...
Hi,

I have data in cells A3:C200, with the auto filter ON

I am trying to automate some procedures, and would like to put a value in
cell say "A1" which would represent the auto filter query I am looking for
column "C"

so far I have tried

Dim WSCode As String
WSCode = Worksheets("Sheet1").Cells(1, 1).Value
Selection.AutoFilter Field:=3, Criteria1:="WSCode"


but it doesn't work....

Can someone please give me a hand?

Thanks

André





Nick Hodge

VBA auto filter question
 
Andre

Tested...yes fine

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Andre Croteau" wrote in message
...
Hi,

I have data in cells A3:C200, with the auto filter ON

I am trying to automate some procedures, and would like to put a value in
cell say "A1" which would represent the auto filter query I am looking for
column "C"

so far I have tried

Dim WSCode As String
WSCode = Worksheets("Sheet1").Cells(1, 1).Value
Selection.AutoFilter Field:=3, Criteria1:="WSCode"


but it doesn't work....

Can someone please give me a hand?

Thanks

André





Andre Croteau

VBA auto filter question
 
Thank you...works well now



"Nick Hodge" wrote in message
...
Andre

Tested...yes fine

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Andre Croteau" wrote in message
...
Hi,

I have data in cells A3:C200, with the auto filter ON

I am trying to automate some procedures, and would like to put a value

in
cell say "A1" which would represent the auto filter query I am looking

for
column "C"

so far I have tried

Dim WSCode As String
WSCode = Worksheets("Sheet1").Cells(1, 1).Value
Selection.AutoFilter Field:=3, Criteria1:="WSCode"


but it doesn't work....

Can someone please give me a hand?

Thanks

André








All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com