I have the following code which should find the longest string in an array. I want to modify it to exclude hidden rows, however. Any ideas on how I might do this?
Code:
Dim cell As Range
Dim strLongestCellRef As String
Dim intLongestCellLen As Integer
For Each cell In Sheets("Sheet1").Range("B6:B45")
If Len(cell) >= intLongestCellLen Then
intLongestCellLen = Len(cell)
strLongestCellRef = cell.Value
End If
Next cell