Hello,
I am filtering column A (the only column in the sheet) for all rows that begins with an @ sign.
The delete all rows that do not start with an @ sign
I have some code which does this OK.
However I also want the filter to return the row directly above the one found with the @ sign.
And keep this row when the rest are deleted.
I am guessing I need to use offset in some way?
There will never be two rows next to each other that start with an @ sign so no additional sanity checking is needed.
Eventually I would like the row above, that does not contain the @ sign, to be moved to the column (B) next to its related one containing the @ sign. Hope this makes sense.
Guessing I have to use transpose here?
This si what i have so far:
Is what I need available in Excel?
If so, is anyone able to help?
Many thanks,
Paul
I am filtering column A (the only column in the sheet) for all rows that begins with an @ sign.
The delete all rows that do not start with an @ sign
I have some code which does this OK.
However I also want the filter to return the row directly above the one found with the @ sign.
And keep this row when the rest are deleted.
I am guessing I need to use offset in some way?
There will never be two rows next to each other that start with an @ sign so no additional sanity checking is needed.
Eventually I would like the row above, that does not contain the @ sign, to be moved to the column (B) next to its related one containing the @ sign. Hope this makes sense.
Guessing I have to use transpose here?
This si what i have so far:
Code:
Set ws = ActiveWorkbook.Sheets("Testing")
lastRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
Set rng = ws.Range("A1:A" & lastRow)
With rng
.AutoFilter Field:=1, Criteria1:="<>*@*"
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
ws.AutoFilterMode = False
Is what I need available in Excel?
If so, is anyone able to help?
Many thanks,
Paul