Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
hide and unhide rows
Hi, I have the following situation in excel: I have a worksheet with a lot of data (text) in colomn B. This data i split in pieces with above and beneath every piece an empty cell. I us textboxes to assign macros to hide and unhide the pieces of data. Th VBA code of one of these macros is: Sub ProcessGroup5() Dim rw As Long rw = 5 Hide_or_Unhide rw End Sub Sub Hide_or_Unhide(rw As Long) Dim rng As Range, i As Long, j As Long Dim ar As Range Set rng = Columns(2).SpecialCells(xlConstants, xlTextValues) i = 0 j = 0 For Each ar In rng.Areas i = i + 1 If i = rw Then j = WorksheetFunction.CountIf(ar.Offset(0, 4), "*") If j 0 And ar.EntireRow.Hidden = False Then Cells(ar.Row, "J").Select Else ar.EntireRow.Hidden = Not ar.EntireRow.Hidden If ar.EntireRow.Hidden = True Then Cells(ar.Row - 1, "J").Select Else: Cells(ar.Row, "J").Select End If End If Exit Sub End If Next End Sub There is only one problem. Column F is never really empty, there is a formula in it and there i only an outcome when there is a number in both column J and M. Wit this code above Column F has to be empty to hide the rows. Does someone have a solution for this? Thanks in advance -- leonida ----------------------------------------------------------------------- leonidas's Profile: http://www.excelforum.com/member.php...fo&userid=3537 View this thread: http://www.excelforum.com/showthread.php?threadid=55220 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Enabling option „Format rows“ to hide/unhide rows using VBA-code? | Excel Discussion (Misc queries) | |||
How to Hide and Unhide Rows | Excel Discussion (Misc queries) | |||
Hide Unhide Rows | Excel Discussion (Misc queries) | |||
Hide/Unhide Rows | Excel Programming | |||
Hide/Unhide rows | Excel Programming |