Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default filters and macros

Hello,
I do have a spreadsheet, where I do have created auto filter.
When I manually set the custom autofilter logic, the correct data will be
filtered.

Now I recorded a macro, which sets the autofilter, copys some subtotal
results and then sets some other filters, where it does the same.

=============
Macro
=============
Selection.AutoFilter Field:=13, Criteria1:="0,5", Operator:=xlAnd, _
Criteria2:="<=1"
Range("T1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("U1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
==================

When I now run the filter, no rows will be selected.

If I go into debug mode and set a breck point after the first cut function,
I can see that the filter was set by the macro, but not activated.

Any idear what when wrong in the recording?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default filters and macros

Hi Martin,

I ran your macro on data designed to mimic your autofilter range and, once
I had changed the first criterion from 0,5 to 0.5 (comma === dot/drop) to
accord with my local settings, it filtered my data as expected.

---
Regards,
Norman



"Martin" wrote in message
...
Hello,
I do have a spreadsheet, where I do have created auto filter.
When I manually set the custom autofilter logic, the correct data will be
filtered.

Now I recorded a macro, which sets the autofilter, copys some subtotal
results and then sets some other filters, where it does the same.

=============
Macro
=============
Selection.AutoFilter Field:=13, Criteria1:="0,5", Operator:=xlAnd, _
Criteria2:="<=1"
Range("T1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("U1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
==================

When I now run the filter, no rows will be selected.

If I go into debug mode and set a breck point after the first cut
function,
I can see that the filter was set by the macro, but not activated.

Any idear what when wrong in the recording?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default filters and macros

Hi Martin,

(comma === dot/drop)


was intended as:

(comma === dot / stop)

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Martin,

I ran your macro on data designed to mimic your autofilter range and,
once I had changed the first criterion from 0,5 to 0.5 (comma ===
dot/drop) to accord with my local settings, it filtered my data as
expected.

---
Regards,
Norman



"Martin" wrote in message
...
Hello,
I do have a spreadsheet, where I do have created auto filter.
When I manually set the custom autofilter logic, the correct data will be
filtered.

Now I recorded a macro, which sets the autofilter, copys some subtotal
results and then sets some other filters, where it does the same.

=============
Macro
=============
Selection.AutoFilter Field:=13, Criteria1:="0,5", Operator:=xlAnd, _
Criteria2:="<=1"
Range("T1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("U1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
==================

When I now run the filter, no rows will be selected.

If I go into debug mode and set a breck point after the first cut
function,
I can see that the filter was set by the macro, but not activated.

Any idear what when wrong in the recording?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default filters and macros

Norman,
even so my local number setting uses commas, I have changed the macro to dot
and now it works fine.

Thanks Martin


"Norman Jones" wrote:

Hi Martin,

I ran your macro on data designed to mimic your autofilter range and, once
I had changed the first criterion from 0,5 to 0.5 (comma === dot/drop) to
accord with my local settings, it filtered my data as expected.

---
Regards,
Norman



"Martin" wrote in message
...
Hello,
I do have a spreadsheet, where I do have created auto filter.
When I manually set the custom autofilter logic, the correct data will be
filtered.

Now I recorded a macro, which sets the autofilter, copys some subtotal
results and then sets some other filters, where it does the same.

=============
Macro
=============
Selection.AutoFilter Field:=13, Criteria1:="0,5", Operator:=xlAnd, _
Criteria2:="<=1"
Range("T1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("U1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
==================

When I now run the filter, no rows will be selected.

If I go into debug mode and set a breck point after the first cut
function,
I can see that the filter was set by the macro, but not activated.

Any idear what when wrong in the recording?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default filters and macros

Hi Martin,

even so my local number setting uses commas, I have changed the macro to
dot
and now it works fine.


Of course, VBA always uses US settings but translate the dot / stop to a
comma to accord with the user's local settings.

Something I knew and (often) forget!


---
Regards,
Norman



"Martin" wrote in message
...
Norman,
even so my local number setting uses commas, I have changed the macro to
dot
and now it works fine.

Thanks Martin


"Norman Jones" wrote:

Hi Martin,

I ran your macro on data designed to mimic your autofilter range and,
once
I had changed the first criterion from 0,5 to 0.5 (comma === dot/drop)
to
accord with my local settings, it filtered my data as expected.

---
Regards,
Norman



"Martin" wrote in message
...
Hello,
I do have a spreadsheet, where I do have created auto filter.
When I manually set the custom autofilter logic, the correct data will
be
filtered.

Now I recorded a macro, which sets the autofilter, copys some subtotal
results and then sets some other filters, where it does the same.

=============
Macro
=============
Selection.AutoFilter Field:=13, Criteria1:="0,5", Operator:=xlAnd,
_
Criteria2:="<=1"
Range("T1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("U1").Select
Application.CutCopyMode = False
Selection.Copy
Range("AP3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
==================

When I now run the filter, no rows will be selected.

If I go into debug mode and set a breck point after the first cut
function,
I can see that the filter was set by the macro, but not activated.

Any idear what when wrong in the recording?






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
Pivot Table filters, especially DATE filters chris Excel Worksheet Functions 0 August 27th 08 04:33 AM
Using Filters in Macros Plum Excel Discussion (Misc queries) 1 December 1st 06 01:08 PM
Using Filters in Macros TMC Excel Discussion (Misc queries) 0 November 30th 06 04:09 AM
Filters, Subtotal & Intacted Results after the filters' Removal kasiopi Excel Discussion (Misc queries) 5 February 24th 06 12:18 PM
macros, filters, HELP CaveMan Excel Programming 3 December 17th 03 03:53 AM


All times are GMT +1. The time now is 12:44 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"