Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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
-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to automatically delete non-contiguous rows Hucleberry Hound Excel Discussion (Misc queries) 2 June 28th 12 03:14 PM
Join non-contiguous ranges into one range via named range? ker_01 Excel Discussion (Misc queries) 3 May 1st 09 11:09 AM
Adding Data to a Non-Contiguous Range in Excel 2007 Tripp Martin Charts and Charting in Excel 1 November 12th 08 09:47 PM
delete row if no data, non-contiguous range problem Nile Gilmanov Excel Programming 12 April 23rd 05 12:36 PM
Non Contiguous range and loops David Excel Programming 3 November 3rd 03 01:40 PM


All times are GMT +1. The time now is 11:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"