Hi Guys,
I need a macro to delete rows with spaces greater than 20. I don't know how excel define a space so I'm not sure where to start.
Can anyone help with this one? Thanks!
Hi Guys,
I need a macro to delete rows with spaces greater than 20. I don't know how excel define a space so I'm not sure where to start.
Can anyone help with this one? Thanks!
Last edited by japorms; 11-16-2009 at 12:52 PM.
Why not post an example workbook which has examples of what you mean by 20 spaces.
Include both types of rows and let us know which you think should be deleted.
Here's a sample
try this,
![]()
Sub X() Dim lngRow As Long With ActiveSheet For lngRow = .Cells(.Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Len(.Cells(lngRow, 1)) > 0 Then If Len(Trim(Left(.Cells(lngRow, 1), 20))) = 0 Then .Cells(lngRow, 1).EntireRow.Delete End If End If Next End With End Sub
Thanks! It work perfectly.
I'll study this code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks