Hello gtg653t,
This macro will return the count of visible columns when the filter is applied. Copy this code and add paste it into Module1 of your project. You can call use this a worksheet function or call inside your VBA code.
Function VisibleColumns() As Long
Application.Volatile
Dim N As Long, C As Long
C = 3
Do
With ActiveSheet.Cells(2, C)
If .Value = "" Then Exit Do
If .EntireColumn.Hidden = False Then
N = N + 1
End If
End With
C = C + 1
Loop
VisibleColumns = N
End Function
Example
'Using it like a Worksheet formula
=VisibleColumns()
'Calling it inside VBA
N = VisibleColumns
Sincerely,
Leith Ross
Bookmarks