Hi Thomas,

'Try below code:-
Sub del()
Cells(1, 1).Select
Selection.EntireRow.Select
For i = 1 To WorksheetFunction.CountA(Range("a:a")) + 15
If WorksheetFunction.CountIf(Selection, "#") > 0 Then
Selection.EntireRow.Delete
Else
Selection.Offset(1, 0).Select
End If
Next
End Sub

Tested File containing this macro is also attached with this email.  Thanks.
-- 
DILIP KUMAR PANDEY
   MBA-HR,B COM(Hons.),BCA
Mobile: +91 9810929744
[email protected]
[email protected]
New Delhi - 110062


On 9/9/09, Thomas Henke <[email protected]> wrote:
>
>
> Dear NG,
>
> I want to delete rows that contain "#". I wrote a small macro for
> this, which principally works, but always one row remains; it is
> neither the first nor the last row and I have checked the macro
> several time, but I don't find any mistake.
> Here is the macro:
>
>
> Dim z As Integer
> Dim length As Integer
>
> Anz_Zeilen = Sheets(Quelle).UsedRange.Rows.Count
>
> With Sheets("Bereinigt")
>
>    For Zeile = 2 To Anz_Zeilen
>
>        length = Len(.Cells(Zeile, 1))
>
>        For z = 1 To length
>
>            If Mid(.Cells(Zeile, 1), z, 1) = "#" Then
>                .Rows(Zeile).Delete
>            End If
>
>        Next z
>
>    Next Zeile
>
> End With
>
> I appreciate any help & thanks in advance
>
> Thomas
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain  @ [email protected] or
Ashish Jain @ [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Attachment: Delete row which contains # - by DILipandey.xls
Description: MS-Excel spreadsheet

Reply via email to