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: 4
Default Decrementing row after deletion

I use the following code to delete a row containing a particular string, but
if two succesive rows contain the string, the second row is skipped. How can
I decrement the row counter, so that after a deletion the next for loop works
on the same row?

For Each C In myRange
C.Select
MyPos = InStr(1, C.Value, strWhat, 1)
If MyPos 0 Then
Response = MsgBox("Delete?", vbYesNo + vbQuestion)
If Response = vbYes Then
Selection.EntireRow.Delete
End If
End If
Next

Any help would be much appreciated,

Sue

--
I''m not a complete idiot - there are some parts missing!
 
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
#Ref! after row deletion Rick Excel Discussion (Misc queries) 3 March 19th 10 04:39 PM
Subtract two dates (decrementing daily) and add text Peter Excel Worksheet Functions 5 October 29th 08 01:35 AM
name deletion rk0909 Excel Discussion (Misc queries) 2 January 4th 08 11:03 PM
dup value deletion italiavb Excel Programming 0 February 6th 07 01:14 AM
Row Deletion Dan Excel Programming 3 September 1st 04 10:40 PM


All times are GMT +1. The time now is 04:18 AM.

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

About Us

"It's about Microsoft Excel"