从已过滤的范围切割后的空白行
我使用下面的代码来设置一个filter,并从filter中删除某些数据,并将其放入另一个选项卡。
不过我有两个问题:
- 当我从过滤的表格中剪切数据(我正在使用
.EntireRow.Cut
)时,我在filter中留下了空行。 如何在不留空白行的情况下裁剪数据? - 我想
Cut
filter数据(排除第1行中的标题)。 我不能使用偏移量或.Resize
因为它需要我到一个隐藏的行(不包括在filter范围内)。 我如何解决这个问题?
代码是:
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)
在Siddharth Rout的全力支持下,我设法解决了这个问题:
我已经使用了以下内容:
.SpecialCells(xlCellTypeVisible)
这使我只能select可见的细胞切割。
我设置和dynamic范围,并使用.Resize
取消select标题,所以我只剪切我已经过滤的数据。
再次感谢您的支持。
夏兰。