Counting visible cells
Sub sistance()
Dim c As Integer
For c = 1 To 256
If Columns(c).EntireColumn.Hidden = True Then
colcount = colcount + 1
End If
Next
MsgBox (colcount)
End Sub
--
Gary's Student
"Otto Moehrbach" wrote:
Excel XP, Win XP
Helping an OP.
I have a range with numerous hidden columns.
The hidden columns are not contiguous.
Columns A:B are always visible.
I want to count the number of visible columns.
Row 4 is the header row, so I want to count the number of visible cells in
Row 4.
I use the following code to give me that count. I get an error on this
line.
The error message is "Unable to get the SpecialCells property of the range
class."
ColCount = Range("A4", Cells(4, Columns.Count).End(xlToLeft)) _
.SpecialCells(xlCellTypeVisible).Count
This seems simple to do. What am I doing wrong? Thanks for your time.
Otto
|