• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Deleting rows with certain criteria - Help today PLEASE

Cynthia Zone

New Member
Hello,

I am trying to add another criteria to my macro below. I need to delete any rows with numbers less than 5 digits. Can you please help me with the code.
This is what I have now.

Code:
Sub DeleteRowsNotCheques()
  Columns("B").Replace "dep*", "#N/A", xlPart
  Columns("B").Replace "dd*", "#N/A", xlPart
  Columns("B").Replace "P*", "#N/A", xlPart
  Columns("B").Replace "XXX*", "#N/A", xlPart
  Columns("B").Replace "", "#N/A", xlPart
  Columns("B").Replace "Transfer", "#N/A", xlPart
  On Error Resume Next
  Columns("B").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
  On Error GoTo 0
  Columns("C").Replace "", "#N/A", xlPart
  On Error Resume Next
  Columns("C").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
  On Error GoTo 0

End Sub
Thank you
 
Last edited by a moderator:
Back
Top