Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete extra rows from bottom? Lentenrose Excel Discussion (Misc queries) 1 November 10th 06 05:23 PM
How do i delete blank lines at bottom of an Excel worksheet? JoeOvercoat Excel Discussion (Misc queries) 2 September 2nd 06 11:54 PM
Delete all rows below my data to the bottom of the sheet Dan Winterton[_2_] Excel Programming 5 August 31st 06 03:30 PM
How do I delete blank rows at the bottom of a spreadsheet to get . Miklaurie Excel Discussion (Misc queries) 1 January 26th 05 02:30 PM
Go to last row of data and delete the rest to bottom of s/sheet Tempy Excel Programming 6 April 9th 04 12:33 PM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"