View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Kjellk Kjellk is offline
external usenet poster
 
Posts: 10
Default Delete blank rows if more than one

Hi
Just perfect!
Regards
Kjell

"Jacob Skaria" wrote:

Use the below macro. If you are new to macros set the Security level to
low/medium in (Tools|Macro|Security). From workbook launch VBE using
short-key Alt+F11. From menu 'Insert' a module and paste the below code.
Save. Get back to Workbook. Run macro from Tools|Macro|Run <selected macro()

Sub Delete2EmptyRows()
Dim lngTemp As Long, lngRow As Long
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If WorksheetFunction.CountBlank(Rows(lngRow)) = Columns.Count Then
If lngTemp = lngRow + 1 Then Rows(lngTemp).Delete
lngTemp = lngRow
End If
Next
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Kjellk" wrote:

I have groups of data divided by blank rows. It is not consistent- sometimes
its one row, sometimes it is more. I want to to keep one blank row between
every group and remove the others.