• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

'Private Sub Worksheet..' macro disables cut copy paste between sheets

ArialBlue

New Member
Hi

I have a workbook with several worksheets of data. Most of the worksheets have tables with filters on them. I have used the below macro to ensure the filters on the tables are automatically updated if any changes are made on that sheet. However, doing so prevents me from copying and pasting data between the sheets that have the macro in it. Can you please tell me how I can correct this? I would like to be able to copy- paste data between the sheets.

I'm pretty new to VB so would really appreciate any help I can get. Thank you!

[Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Range("Table14").AutoFilter Field:=1, Criteria1:="<>0", _
Operator:=xlAnd
End Sub]
 
Hi ArialBlue

Change your procedure from a selection change event to a change event. Also can tidy your coding up a bit.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Range("Table14").AutoFilter 1, "<>0"
End Sub

Should do the trick.

Take care

Smallman
 
Back
Top