vba auto filter problem

aiwnjoo

Well-known Member
Joined
Jul 30, 2009
Messages
598
hi,

If i have some cells copied on the clipboard then move to another sheet that has this code embedded;

Code:
Private Sub Worksheet_Activate()
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = False
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=14, Criteria1:="="
Selection.AutoFilter Field:=8, Criteria1:=">=1", Operator:=xlAnd
Application.ScreenUpdating = True
End Sub

It forgets the copied data from the previous sheet, any workaround for this?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
thx dude but adding an event for;

Application.CutCopyMode = False before the code starts crashes it out for a while then just applies the filter anyway.

Im guessing im not doing it right;

Code:
Private Sub Worksheet_Activate()
 
Application.CutCopyMode = False

ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = False
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=14, Criteria1:="="
Selection.AutoFilter Field:=8, Criteria1:=">=1", Operator:=xlAnd
Application.ScreenUpdating = True
End Sub
 
Upvote 0
More like:

Code:
Private Sub Worksheet_Activate()
    If Application.CutCopyMode = False Then
        ActiveSheet.AutoFilterMode = False
        Application.ScreenUpdating = False
        Rows("1:1").Select
        Selection.AutoFilter
        Selection.AutoFilter Field:=14, Criteria1:="="
        Selection.AutoFilter Field:=8, Criteria1:=">=1", Operator:=xlAnd
        Application.ScreenUpdating = True
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top