Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Hiding an empty row?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
british.assassi - 22 Jan 2006 20:20 GMT
Hi

I currently use the following code to delete the entire row if it empty
in a selection.

Code:
--------------------
   Sub del_empty_row()
 Rng = Selection.Rows.Count
 ActiveCell.Offset(0, 0).Select
 Application.ScreenUpdating = False
 For i = 1 To Rng
 If ActiveCell.Value = 0 Then
 Selection.EntireRow.Delete
 Else
 ActiveCell.Offset(1, 0).Select
 End If
 Next i
 Application.ScreenUpdating = True
 End Sub
--------------------

This code works fine, but really I would rather hide the row.

Whenever I change *Selection.EntireRow.Delete* to
*Selection.EntireRow.Hidden = True* it stops after the first row if
finds is empty.

I would be very grateful if somebody could help me with this.

TIA

british.assassin

Signature

british.assassi

Gary''s Student - 22 Jan 2006 21:08 GMT
Try:
For i = Rng to 1 step -1
Signature

Gary''s Student

> Hi
>
[quoted text clipped - 29 lines]
>
> british.assassin
Tom Ogilvy - 22 Jan 2006 21:09 GMT
   Sub Hide_empty_row()
 Rng = Selection.Rows.Count
 ActiveCell.Offset(0, 0).Select
 Application.ScreenUpdating = False
 For i = 1 To Rng
 If ActiveCell.Value = 0 Then
 Selection.EntireRow.Hidden = True
 End If
 ActiveCell.Offset(1, 0).Select
 Next i
 Application.ScreenUpdating = True
 End Sub

Signature

Regards,
Tom Ogilvy

> Hi
>
[quoted text clipped - 29 lines]
>
> british.assassin
british.assassi - 22 Jan 2006 23:32 GMT
Thanks so much Tom :D

Signature

british.assassi

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.