excel - VBA 过滤多个值然后发送到新工作表
问题描述
我目前正在处理需要自动过滤然后粘贴到新工作表的数据。但是,我不确定如何为其添加另一个标准。
Dim sh As Worksheet, ws As Worksheet
Dim LstR As Long, rng As Range
Set sh = Sheets("Sheet1") 'set the sheet to filter
Set ws = Sheets("Sheet2") 'set the sheet to paste
Application.ScreenUpdating = False
With sh 'do something with the sheet
LstR = .Cells(.Rows.Count, "D").End(xlUp).Row 'find last row
.Columns("D:D").AutoFilter Field:=1, Criteria1:="UKS"
Set rng = .Range("A2:Z" & LstR).SpecialCells(xlCellTypeVisible) 'Replace Z with correct last column
rng.Copy ws.Cells(ws.Rows.Count, "A").End(xlUp).Offset(1)
.AutoFilterMode = False
End With
End Sub
解决方案
推荐阅读
- javafx - 显示 ArrayList 的值
- > 在 TableView (JavaFX) 中
- swift - 无法查看并使其工作 - 斯威夫特
- c++ - C++ 模板函数在 Visual Studio 2019 中不起作用 [错误 2668]
- opencv - 有没有办法使用 OCR 从 CAD 技术图纸中提取特定数据?
- node.js - 如何在 Mongo 查询中传递变量
- postgresql - Fabric-ca-server 重启后无法初始化 postgres 数据库
- python - 如何在 Python 中正确安装 MySQL 模块
- linux - 如何将结果写入空变量?
- java - Maven 构建失败:包不存在
- javascript - 对大数使用 math.floor() 运算时出现意外结果