Determine If Cell is Hidden in VBA

If a cell is hidden, then either its row is hidden or its column is hidden. Either of these statements will return True if the cell is hidden

Range(”C7″).ColumnWidth = 0 Or Range(”C7″).RowHeight = 0
Range(”C7″).EntireColumn.Hidden Or Range(”C7″).EntireRow.Hidden

2 Comments

  1. Mike M.:

    What about the case where the font colorindex is set to the color of the cell?
    Range(”F3″).font.colorindex and
    range(”F3″).interior.colorindex do not yield like results

  2. Jon Peltier:

    Mike -

    If you color the font white, the font color index (using the default palette) is 2, and the interior color index is -4142, the default interior color index.

    If you explicitly color the cell interior white, both font and interior have color index of 2.

    I suspect you’re comparing the non default font color and the default interior, and even though they look the same, their indexes are different.

    - Jon

Leave a comment