Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hide and Unhide rows automaticely

Can i hide the specific row (here row 10) when there is
no data in J10 - K10 - L10
and when there is data in one or more of these cells the
row unhides automaticely

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Hide and Unhide rows automaticely


Automatically: no, not with any standard excel option.

With macro's: yes, but An change_event macro would be totally useless:
if a user start typing in a row it is hidden unless he start typing in
j,k or l

you could call the macro from the sheet activate event.

note: the code is ok until the union reaches around 600 areas...
then performance will degrade rapidly.

Sub HideUnHideJKL()
Dim rJKL As Range, rRow As Range, rHide As Range

With ActiveSheet
Set rJKL = Intersect(.UsedRange, .Range("J:L"))
End With

'populate rHide so no need to test the union
Set rHide = rJKL.Offset(rJKL.Rows.Count).Cells(1)
For Each rRow In rJKL.Rows
If Application.CountA(rRow) = 0 Then
Set rHide = Union(rHide, rRow)
End If
Next

Application.ScreenUpdating = False
With ActiveSheet
'strip the dummy from rHide
Set rHide = Intersect(.UsedRange, rHide)
.UsedRange.EntireRow.Hidden = False
rHide.EntireRow.Hidden = True
End With
Application.ScreenUpdating = True

End Sub





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


r v deursen wrote :

Can i hide the specific row (here row 10) when there is
no data in J10 - K10 - L10
and when there is data in one or more of these cells the
row unhides automaticely

Thank you

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
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
How to Hide and Unhide Rows Jonno Excel Discussion (Misc queries) 2 June 9th 09 04:34 PM
CommandButton used to hide and unhide rows Leiprecht Excel Discussion (Misc queries) 1 April 9th 09 06:05 PM
Hide Unhide Rows blackstar Excel Discussion (Misc queries) 2 February 6th 06 09:36 PM
How to hide and unhide rows Michael168[_10_] Excel Programming 1 October 6th 03 11:52 AM


All times are GMT +1. The time now is 02:59 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"