delete row if no data, non-contiguous range problem
Hi my name is Nile.
I have the following code that checks every row from the bottom for any data and having found none deletes it, then goes on, it is limited to the certain range. It works fine with contiguous range such as ("A10:C20"), but does not work with non-contiguous ranges such as ("A10:C20, E10:G20")... can someone help me please? here is the code: -=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=- Dim i As Long 'turn off calculation and screenupdating. With Application ..Calculation = xlCalculationManual ..ScreenUpdating = False Range("A8:A58,D8:K58").Select 'working backwords because deleting rows. For i = Selection.Rows.Count To 1 Step -1 If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then Selection.Rows(i).EntireRow.Delete End If Next i ..Calculation = xlCalculationAutomatic ..ScreenUpdating = True End With -=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=- |
All times are GMT +1. The time now is 03:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com