Results 1 to 3 of 3

hide/unhide rows based on cell value

Threaded View

alexandruc hide/unhide rows based on... 10-12-2009, 03:24 AM
DonkeyOte Re: hide/unhide rows based on... 10-12-2009, 03:37 AM
alexandruc Re: hide/unhide rows based on... 10-12-2009, 06:49 AM
  1. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: hide/unhide rows based on cell value

    Various options ... if you want to avoid using the Calculate event then you would need to provide more info. with regard to how Col D on this sheet is affected by changes elsewhere. If you rely on the Calculate event then you will need to process all rows with each calculation, however, you can avoid iteration using AutoFilter etc or using temp formulae, an example of the latter

    Public Sub Worksheet_Calculate()
    Dim xlCalc as XLCalculation
    On Error GoTo ExitPoint
    With Application
        xlCalc = .Calculation
        .Calculation = xlCalculationManual
        .ScreenUpdating = False
        .EnableEvents = False
    End With
    With Range("D10:D1425")
        .EntireRow.Hidden = False
        With .Offset(,Columns.Count - .Column)
            .FormulaR1C1 = "=IF(RC4=""-"",""X"",0)"
            On Error Resume Next
            .SpecialCells(xlCellTypeFormulas,xlTextValues).EntireRow.Hidden = True
            On Error GoTo ExitPoint
            .Clear
        End With
    End With        
    ExitPoint:
    With Application
        .Calculation = xlCalc
        .ScreenUpdating = True
        .EnableEvents = True
    End With
    End Sub
    To insert the above right click on the tab in question select View Code and paste above into resulting window. As and when this sheet is recalculated so the row visibility will update accordingly. Note altering row visibility is volatile hence the toggling of App level settings.
    Last edited by DonkeyOte; 10-12-2009 at 05:50 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1