Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49956

ActiveCell.Rows(row number.Hidden returns false when row is hidden sometimes

$
0
0
I am trying to implement a very simple user form that has previous and next buttons to navigate through sheet that has rows filtered out.

I was hoping to use the Hidden property to let me know whether to select an unfiltered (visible) row or not. However, sometimes it is returning False on a row that is not visible. I can not figure out why. it also seems dependent on where the active selection is. For example, if Rows 35 and 40 are visible, and selection is on row 40, then it returns False if I test for row 36.

If selection is on row 35, it does correctly return true for row 36.

Here's some basic test code I wrote to try and figure out how Hidden works:

Code:

Sub isHidden()

Dim isHidden As Boolean

isHidden = ActiveCell.Rows(36).Hidden

If isHidden Then
  MsgBox "36 is hidden"
Else
  MsgBox "36 is not hidden"
End If

isHidden = ActiveCell.Rows(37).Hidden

If isHidden Then
  MsgBox "37 is hidden"
Else
  MsgBox "37 is not hidden"
End If

End Sub

I can attach a simple file if you think it's dependent on my particular data.

Thanks!

Viewing all articles
Browse latest Browse all 49956

Trending Articles