【发布时间】:2019-05-02 20:28:14
【问题描述】:
我试图在过滤我的数据集后复制一个特定的列(不包括标题)。如果过滤后有多行,我选择的范围可以正常工作,我可以将该列复制到另一个工作表中。但是,如果过滤后只有一行,当我指定范围时,它会选择所有空单元格以及非空单元格,并且我的代码出现故障。我该如何解决这个问题?
我尝试使用不同的范围属性,但无法获得预期的结果
'''Finding the Pack Test Category from the filtered 1st column'''
Set RngA = ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTypeVisible).Areas(2)(1, 1)
''Here the selection of range includes all the empty cells as well!
Set RngA = Range(RngA, RngA.End(xlDown))
'''Copy & Pasting in the Forecast Sheet for temporary use'''
RngA.SpecialCells(xlCellTypeVisible).Copy Destination:=wbA.ActiveSheet.Range("L1")
我希望只选择具有数据的可见单元格而不是空单元格的范围。
【问题讨论】: