Can you conditionally hide a cell? - Page 2
Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Can you conditionally hide a cell?

  1. #11
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    If Target.Address = "$A$1:$A$125" then
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  2. #12
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Posts
    480
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    This is the ultimate solution, I think
    Just enter the correct range to check.


    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    Dim CheckRange As Range
    'range to check
    Set CheckRange = Range("a1:d20")
    CheckColMin = CheckRange.Column
    CheckRowMin = CheckRange.Row
    CheckColMax = CheckRange.Column + CheckRange.Columns.Count - 1
    CheckRowMax = CheckRange.Row + CheckRange.Rows.Count - 1

    'check if the changed cell is a part of the range to check
    If Target.Column >= CheckColMin And Target.Column <= CheckColMax _
    And Target.Row >= CheckRowMin And Target.Row <= CheckRowMax Then

    Rows(Target.Row).Select
    'does the selection contains alfanumeric items ?
    If Application.CountA(Selection) = Application.Count(Selection) Then
    'no alfanumeric items, check now the values
    If Application.Sum(Selection) = 0 Then
    'only 0 of empty cells found, hide the row now
    Rows(Target.Row).EntireRow.Hidden = True
    End If
    End If
    Target.Select
    End If

    End Sub


User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com