Delete from the bottom up
I am wondering if it's possible to delete from the bottom up but by
recognizing strings not numbers. I have a list like this. Item1 Item1 Item1 Item1 Item3 Item4 Item4 Now is there a way for a loop to run and either work from the bottom going up deleting everything that is not an item1 or is there a way from the top to look down and see where it's no longer item one and delete everything under it. However, I don't need to delete the whole row just the column. Thanks |
Delete from the bottom up
I would probably use code something like this...
Sub DeleteStuff() Dim rngFound As Range With Sheets("Sheet1") Set rngFound = .Range("A:A").Find(What:="Item 1", _ After:=.Range("A1"), _ Lookat:=xlWhole, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Offset(1, 0) If Not rngFound Is Nothing Then .Range(rngFound, .Cells(Rows.Count, "A")).Delete Shift:=xlUp End If End With End Sub -- HTH... Jim Thomlinson " wrote: I am wondering if it's possible to delete from the bottom up but by recognizing strings not numbers. I have a list like this. Item1 Item1 Item1 Item1 Item3 Item4 Item4 Now is there a way for a loop to run and either work from the bottom going up deleting everything that is not an item1 or is there a way from the top to look down and see where it's no longer item one and delete everything under it. However, I don't need to delete the whole row just the column. Thanks |
All times are GMT +1. The time now is 10:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com