VBA selecting visible cells after filtering

后端 未结 2 1705
一整个雨季
一整个雨季 2020-12-21 23:04

The following code applies filters and selects the top 10 items in column B after some filters are applied to the table. I have been using this for many different filtered

2条回答
  •  被撕碎了的回忆
    2020-12-21 23:18

    Thank you to @Rory

    Specialcells
    

    Doesn't work with one cell selected. Adapted by doing the following:

    ......

    For Each rC In r
        j = j + 1
        If j = 10 Or j = r.Count Then Exit For
    Next rC
    
    If j = 1 Then
        Range(r(1), rC).Copy
    Else
        Range(r(1), rC).SpecialCells(xlCellTypeVisible).Select
    End If
    
    Worksheets("For Slides").Range("P29").PasteSpecial
    Worksheets("OLD_Master").ShowAllData
    
    End Sub
    

提交回复
热议问题