Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel VBA filtering

I am working on a database of numbers and I want to filter only the zero
values of a particular field. I tried the following code but no records were
found:
Selection.AutoFilter Field:=8, Criteria1:="0,00"
I even tried recording my moves for a number of different critieria and I
made sure that my criteria resulted in some records been found. However when
I tried to run my moves no records were found. Below are the moves I recorded:
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"(5.115,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"=(3.096,00)", Operator:=xlOr, Criteria2:="=(3.000,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:=Array( _
"(1.117,99)", "(1.270,00)", "(1.414,00)", "(1.914,00)", "(1.960,00)",
"(2.451,00)", _
"(3.000,00)", "(3.096,00)", "(335,00)", "(487,80)", "(5.115,00)",
"(550,00)", _
"(652,00)", "(700,00)", "(72,00)", "(74,00)", "(74,05)", "400,00"),
Operator:= _
xlFilterValues
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:="0,00"
I even restarted excel but no luck. Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Excel VBA filtering

Remember that VBA only reads English and it does not recognize 0,00 as a
number, it sees it as text. In your worksheet you have local settings that
make the comma appear as a decimal point would in an English worksheet. That
is OK for the worksheet to use the comma decimal point and it knows how to
deal with numbers like that, but VBA does not. So you have numbers in your
worksheet and VBA is looking for a string to match to them. Like matching
apples to oranges, there is none.
Change your Criteria to "0.00" and VBA will now look for a number to match.

Mike F
"Costas Limassol" wrote in
message ...
I am working on a database of numbers and I want to filter only the zero
values of a particular field. I tried the following code but no records
were
found:
Selection.AutoFilter Field:=8, Criteria1:="0,00"
I even tried recording my moves for a number of different critieria and I
made sure that my criteria resulted in some records been found. However
when
I tried to run my moves no records were found. Below are the moves I
recorded:
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"(5.115,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"=(3.096,00)", Operator:=xlOr, Criteria2:="=(3.000,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8,
Criteria1:=Array( _
"(1.117,99)", "(1.270,00)", "(1.414,00)", "(1.914,00)", "(1.960,00)",
"(2.451,00)", _
"(3.000,00)", "(3.096,00)", "(335,00)", "(487,80)", "(5.115,00)",
"(550,00)", _
"(652,00)", "(700,00)", "(72,00)", "(74,00)", "(74,05)", "400,00"),
Operator:= _
xlFilterValues
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:="0,00"
I even restarted excel but no luck. Can anyone help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel VBA filtering

It worked! Thanks a lot Mike!

"Mike Fogleman" wrote:

Remember that VBA only reads English and it does not recognize 0,00 as a
number, it sees it as text. In your worksheet you have local settings that
make the comma appear as a decimal point would in an English worksheet. That
is OK for the worksheet to use the comma decimal point and it knows how to
deal with numbers like that, but VBA does not. So you have numbers in your
worksheet and VBA is looking for a string to match to them. Like matching
apples to oranges, there is none.
Change your Criteria to "0.00" and VBA will now look for a number to match.

Mike F
"Costas Limassol" wrote in
message ...
I am working on a database of numbers and I want to filter only the zero
values of a particular field. I tried the following code but no records
were
found:
Selection.AutoFilter Field:=8, Criteria1:="0,00"
I even tried recording my moves for a number of different critieria and I
made sure that my criteria resulted in some records been found. However
when
I tried to run my moves no records were found. Below are the moves I
recorded:
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"(5.115,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:= _
"=(3.096,00)", Operator:=xlOr, Criteria2:="=(3.000,00)"
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8,
Criteria1:=Array( _
"(1.117,99)", "(1.270,00)", "(1.414,00)", "(1.914,00)", "(1.960,00)",
"(2.451,00)", _
"(3.000,00)", "(3.096,00)", "(335,00)", "(487,80)", "(5.115,00)",
"(550,00)", _
"(652,00)", "(700,00)", "(72,00)", "(74,00)", "(74,05)", "400,00"),
Operator:= _
xlFilterValues
ActiveSheet.Range("$A$1:$J$258").AutoFilter Field:=8, Criteria1:="0,00"
I even restarted excel but no luck. Can anyone help?




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
Excel filtering Deb Simon Excel Worksheet Functions 3 October 30th 09 03:43 PM
Filtering in Excel KalyanS Excel Discussion (Misc queries) 3 October 21st 09 06:38 PM
EXCEL FILTERING Chillipepper Excel Discussion (Misc queries) 1 May 24th 06 03:36 PM
Excel Filtering dbusser Excel Discussion (Misc queries) 7 January 30th 06 12:10 AM
trouble filtering a list. Why isn't column filtering? Pat Excel Worksheet Functions 1 July 18th 05 03:30 PM


All times are GMT +1. The time now is 02:56 PM.

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"