![]() |
#3
|
||||
|
||||
![]()
The following will work with your examples:
Code:
Sub DeleteEmptyRows() Dim rng As Range Dim i As Long Dim LastRow As Long Dim LastCol As Long With ActiveSheet LastRow = .Cells(.rows.Count, "G").End(xlUp).Row 'G is the column with the last row of data LastCol = .Cells(10, .Columns.Count).End(xlToLeft).Column '10 is the first row of the range Set rng = .Range("A10:H" & LastRow) 'Set the range to the area to be processed For i = LastRow To 10 Step (-1) 'Process from the bottom 'remove the empty rows If WorksheetFunction.CountA(rng.rows(i)) = 0 Then rng.rows(i).Delete Next End With End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Bathroth | Word VBA | 1 | 10-01-2014 01:40 PM |
![]() |
dennist77 | Word | 1 | 10-29-2013 11:39 PM |
![]() |
dozd | Excel | 1 | 02-22-2013 03:24 AM |
![]() |
Hoochtheseal | Word VBA | 1 | 01-29-2013 09:23 PM |
![]() |
Learner7 | Excel | 1 | 04-19-2011 02:45 AM |