Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete extra rows from bottom? | Excel Discussion (Misc queries) | |||
How do i delete blank lines at bottom of an Excel worksheet? | Excel Discussion (Misc queries) | |||
Delete all rows below my data to the bottom of the sheet | Excel Programming | |||
How do I delete blank rows at the bottom of a spreadsheet to get . | Excel Discussion (Misc queries) | |||
Go to last row of data and delete the rest to bottom of s/sheet | Excel Programming |