none
VBA Query - Unable to past visible Cell data. RRS feed

  • Question

  • Hello SME,

    I have a query regarding VBA. I am not able to copy and past the filtered data (visible cells only ) to new excel sheet. I am using excel 2017.

    Can someone help me to overcome this problem?

    Thanks,

    Ashish

    Saturday, December 9, 2017 2:22 PM

All replies

  • This forum is for discussing Microsoft Access database related issues.  I'd urge you to move/repost your question in a forum focusing on Excel so you get the help you seek.

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Sunday, December 10, 2017 12:06 PM
  • Hello,

    What code do you use now? What error do you get? 

    Here is a sample to copy filtered data into a new sheet.

    Sub Demo()
    If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
    ActiveSheet.ShowAllData
    End If
    Range("A1").AutoFilter
    ActiveSheet.Range("$A$1:$B$7").AutoFilter Field:=1, Criteria1:="a"
    ActiveSheet.AutoFilter.Range.Copy
    Dim sh As Worksheet
    Set sh = Worksheets.Add
    sh.Paste
    End Sub

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 11, 2017 6:11 AM
    Moderator