Copy filtered data to another sheet using VBA

后端 未结 4 652
礼貌的吻别
礼貌的吻别 2020-11-28 16:20

I have two sheets. One has the complete data and the other is based on the filter applied on the first sheet.

Name of the data sheet : Data
Name of

4条回答
  •  再見小時候
    2020-11-28 16:45

    Best way of doing it

    Below code is to copy the visible data in DBExtract sheet, and paste it into duplicateRecords sheet, with only filtered values. Range selected by me is the maximum range that can be occupied by my data. You can change it as per your need.

      Sub selectVisibleRange()
    
        Dim DbExtract, DuplicateRecords As Worksheet
        Set DbExtract = ThisWorkbook.Sheets("Export Worksheet")
        Set DuplicateRecords = ThisWorkbook.Sheets("DuplicateRecords")
    
        DbExtract.Range("A1:BF9999").SpecialCells(xlCellTypeVisible).Copy
        DuplicateRecords.Cells(1, 1).PasteSpecial
    
    
        End Sub
    

提交回复
热议问题