以下のコードを使用してフィルターを設定し、フィルターから特定のデータを切り取って別のタブに配置しています。
ただし、2つの問題があります。
- フィルター処理されたシートからデータ(使用している
.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)