我正在使用下面的代码来设置过滤器并从过滤器中剪切某些数据并将其放入另一个选项卡中。
但是我有两个问题:
- 当我从过滤表中剪切数据(我正在使用
.EntireRow.Cut
)时,我在过滤器中留下了空白行。 如何在不留下空白行的情况下剪切数据? - 我想要
Cut
过滤数据(不包括第 1 行中的标题)。我不能使用偏移量,或者.Resize
因为它将我带到隐藏行(不包括在过滤器范围内)。 我该如何解决这个问题?
代码是:
Lcol = FindLastCol(gcsCombinedKycExportsSheetName)
Lrow = FindLastRow(gcsCombinedKycExportsSheetName)
Set rngToCheck = Range(Sheets(gcsCombinedKycExportsSheetName).Cells(1, 1), _
Sheets(gcsCombinedKycExportsSheetName).Cells(Lrow, Lcol)).Rows
FieldNum = Sheets(gcsCombinedKycExportsSheetName).Cells.Find(What:=gcsSearchFund, After:=[a1], LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext).Column
Sheets(gcsCombinedKycExportsSheetName).Rows(1).AutoFilter
rngToCheck.AutoFilter Field:=FieldNum, Criteria1:= _
"=*[2]*", Operator:=xlOr, Criteria2:="="
Lrow = FindLastRow(gcsCombinedKycExportsSheetName)
LrowRT = FindLastRow(gcsRemovedInvestors)
Sheets(gcsCombinedKycExportsSheetName).Range(Sheets(gcsCombinedKycExportsSheetName).Cells(1, 1), _
Sheets(gcsCombinedKycExportsSheetName).Cells(Lrow, 1)).EntireRow.Cut Sheets(gcsRemovedInvestors).Cells(LrowRT, 1)