excel - 一个更好的自动过滤表代码到另一个表 Visual basic Excel
问题描述
'请谁知道更好的自动过滤器代码,告诉我如何自动过滤到特定列'不是到工作表的末尾
Sub copy_filter_data()
Dim count_col, count_row As Integer
Dim orig, output As Worksheet
Worksheets("Sheet1").Activate
Set orig = ThisWorkbook.Sheets("Sheet1")
Set output = ThisWorkbook.Sheets("Sheet2")
count_col = WorksheetFunction.CountA(Range("A5", Range("A5").End(xlToRight)))
count_row = WorksheetFunction.CountA(Range("A5", Range("A5").End(xlDown)))
ActiveSheet.Range("A5").AutoFilter Field:=18, Criteria:=Cells(5, 35).Value
orig.Range(Cells(5, 1), Cells(count_row, count_col)).SpecialCells(xlCellTypeVisible).Copy
output.Cells(5, 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub
解决方案
推荐阅读
- sql - SQL中解码函数内部的解码函数
- javascript - 不断收到:“尝试导入错误:'loadFrozenModel' 未从 '@tensorflow/tfjs-converter' 导出”
- angular - 在 Angular 中使用 MVC 视图
- java - JPA:使用标准构建器查找实体:属性名称与注释不同?
- php - 在空 PHP5.6 上调用成员函数 query()
- typescript - 如何在 Typescript 中定义一个强制索引签名的泛型
- php - 生成图和 PHP_INT_MAX
- ruby-on-rails - 如何输出原始 SQL Active Record 选择查询的结果?
- laravel - 如何通过数据透视表列对多对多关系中的表进行排序?
- python - 为便携式跑步者构建 apache beam sdk 线束 - 名称问题