LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Deleting rows

Greetings all. I am trying to delete some rows based on whether or not the
right 4 characters in the cell = "View". I am using the following...

LstRow = [B5000].End(xlUp).Row
Set Myrng = Range("B1:B" & LstRow)
For Each MyCell In Myrng
If Right(MyCell, 4) = "View" Then
Rows(MyCell.Row).EntireRow.Delete
End If
Next MyCell

The problem is that I have to run it multiple times to delete all the rows
ending in "View". In column B there are 8 rows of records ending in "View",
then three records not ending in "View", for a total of 11 records per id
value in column A, and this pattern is continuous all the way to around row
4000 or so. When I run it the first time, it deletes the first three rows in
each group. The second time I run it, it deletes the next two records from
each group, and then I have to run it three more times to delete the last
three records from each group. Any ideas why it is doing this? Thank you.

Greg

 
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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
Help!!! I have problem deleting 2500 rows of filtered rows shirley_kee[_2_] Excel Programming 1 January 12th 06 03:15 AM


All times are GMT +1. The time now is 10:41 AM.

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"