VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
VBA loop to delete entire row if cells contain a particular string Posted by bennyblanco on 23 Aug 2012 at 11:36 AM
Hello,

I need code to go through cells of a column of unknown length and delete the entire row if the cells contain a particular string ("--"). This is what I have so far, but it does not work. Can anyone help? I can't program.

Dim RowKdx As Long
For RowKdx = Range("b1").End(xlDown).Row To 2 Step -1
Do While Cells(RowKdx, "b").Value <> ""
If InStr(RowKdx, "--") = 1 Then
Rows(RowKdx).Delete
End If
RowKdx = RowKdx - 1
If RowKdx = 1 Then Exit For
Loop
Next RowKdx




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.