![]() |
Blank lines
I need to be able to delete blank lines in a macro, and the only VBA code I
can find doesn't work if there's a formula in the cell, even if the value is zero. I tried copying and pasting special (Values), but even though the formula isn't there any more, it still won't delete that line. I would appreciate any suggestions. -- Message posted via http://www.officekb.com |
Blank lines
Hi Frank
Do you check one column ? Here is a example for the A column (row 1 -100) Sub Example2() Dim Lrow As Long Dim CalcMode As Long Dim StartRow As Long Dim EndRow As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With With ActiveSheet .DisplayPageBreaks = False StartRow = 1 EndRow = 100 For Lrow = EndRow To StartRow Step -1 If IsError(.Cells(Lrow, "A").Value) Then 'Do nothing, This avoid a error if there is a error in the cell ElseIf .Cells(Lrow, "A").Value = "" Then .Rows(Lrow).Delete End If Next End With With Application .ScreenUpdating = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Frank via OfficeKB.com" wrote in message ... I need to be able to delete blank lines in a macro, and the only VBA code I can find doesn't work if there's a formula in the cell, even if the value is zero. I tried copying and pasting special (Values), but even though the formula isn't there any more, it still won't delete that line. I would appreciate any suggestions. -- Message posted via http://www.officekb.com |
Blank lines
"Frank via OfficeKB.com" wrote in message ... I need to be able to delete blank lines in a macro, and the only VBA code I can find doesn't work if there's a formula in the cell, even if the value is zero. Why not? Paste your c ode. |
Blank lines
WOW! That was great! Thank you so very much. I have tried and tried to make
this work. I'd buy you lunch if you were here. -- Message posted via http://www.officekb.com |
All times are GMT +1. The time now is 02:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com