Reputation: 451
I'm using the below code to setup a filter and cut certain data from the filter and put it into another tab.
However I have two issues:
.EntireRow.Cut
) from the filtered sheet I'm left with blank rows in the filter. How can I cut the data without leaving blank rows?Cut
the filter data (Excluding the header in row 1). I can't use offset or .Resize
as it takes me to a hidden row (not included in the filter range). How do I get around this?Code is:
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)
Upvotes: 1
Views: 533
Reputation: 451
With the full support of Siddharth Rout I have managed to resolve this issue:
I have used the following:
.SpecialCells(xlCellTypeVisible)
This allowed me to select only the visable cells to cut.
I setup and dynamic range and used .Resize
to unselect the header so I cut only the data that I had filtered.
Thanks again for support.
Ciaran.
Upvotes: 1