How to test for a Row being Visible on a Spreadsheet
Try your code this way...
Dim ran1 As Range
Dim ran2 As Range
Set ran1 = Nothing
Set ran2 = Nothing
Set ran1 = Intersect(Rows(6), Cells.SpecialCells(xlCellTypeVisible))
If ran1 Is Nothing Then
MsgBox "6 is hidden"
Else
MsgBox "6 is not hidden"
End If
Set ran2 = Intersect(Rows(15), Cells.SpecialCells(xlCellTypeVisible))
If ran2 Is Nothing Then
MsgBox "15 is hidden"
Else
MsgBox "15 is not hidden"
End If
Rick
" wrote in message
oups.com...
On Oct 16, 2:27 pm, "Dan R." wrote:
.SpecialCells(xlCellTypeVisible)
--
Dan Oakes
Hi Dan, thanks for the quick response.
The following is a snippet of my effort to use this property but
unfortunately the test for row 15 is coming back as nothing (as is the
test for row 6 - which is what I want) :
Dim ran1 As Range
Dim ran2 As Range
Set ran1 = Nothing
Set ran2 = Nothing
On Error Resume Next
ran1 = Rows("6").SpecialCells(xlCellTypeVisible)
If ran1 Is Nothing Then
MsgBox "This is a good thing"
Else
MsgBox "This is a bad thing"
End If
ran2 = Rows("15").SpecialCells(xlCellTypeVisible)
If ran2 Is Nothing Then
MsgBox "This is a bad thing"
Else
MsgBox "This is a good thing"
End If
Thanks,
Niall
|