HasHiddenColumns

HasHiddenColumns

Public Function HasHiddenColumns( _
  rng As Range _
) As Boolean
  Dim _
    rngColumn As Range
  HasHiddenColumns = False
  For Each rngColumn In rng.Columns
    If rngColumn.Hidden Then
      HasHiddenColumns = True
    End If
  Next rngColumn
End Function

Usage:

Dim _
  wsSource As Worksheet, _
  rngSource as Range
Set wsSource = ThisWorkbook.Sheets("Sheet1")
Set rngSource = wsSource.Range("A1", "K32")
If HasHiddenColumns( _
  rngSource _
) Then
  ' Handle it
End If

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *