LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default leave one blank row between data in *visible* rows

I have sets of data (variable number of rows) that are separated by one blank
row. I am programmatically going through the data & hiding any rows that do
not meet certain criteria.

The problem is, after hiding my rows, I am left with several areas that are
separated by more than one blank row. Can anyone help to hide these so that
only one blank row is showing?

I tried to adapt the following to work only on the visible cells, but I
understand that offset will not step past hidden cells.

Thanks!

Sub leaveOneBlankRow()
Dim c As Range
Dim rng As Range
Set rng = Nothing
For Each c In Range("a1:a300")
If IsEmpty(c) Then
If IsEmpty(c.Offset(1, 0)) Then
If rng Is Nothing Then
Set rng = c.Offset(1, 0)
Else
Set rng = union(rng, c.Offset(1, 0))
End If
End If
End If
Next c

If Not rng Is Nothing Then
rng.EntireRow.Hidden = True
End If

End Sub

 
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
Leave Blank If No Data George Excel Discussion (Misc queries) 6 April 26th 10 03:17 AM
How do i leave the arrow for the drop down list visible in Excel? Cara86 Excel Discussion (Misc queries) 2 August 6th 08 09:44 PM
Can I use Sort to alphabetize & leave blank row bet. rows (2003) Sandy New Users to Excel 4 May 18th 08 05:31 PM
Leave cell blank if no data Millerk Excel Discussion (Misc queries) 3 March 1st 06 02:58 PM
Do not show lack of data as a zero on graph lines, leave blank Just Joe Charts and Charting in Excel 1 February 15th 06 08:12 PM


All times are GMT +1. The time now is 09:53 PM.

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"