Saturday, September 24, 2011

Find Hidden Column Names in a Sheet

If you want to know the column names which are hidden in a worksheet.

Here is the code-

Sub find_hidden_column_names()
Dim a As Range, b As Range, cell As Range
Dim bla As Boolean
Dim mscl As String
' change range as per ur requirement
' USE ONLY 1 ROW LIKE A1:Z1 OR A2 :Z2 ... NOT LIKE (A1:Z35)
Set b = Range("a1:z1").SpecialCells(xlCellTypeVisible)
For Each cell In Range("a1:z1")
bla = False
For Each a In b
If Split(cell.Address, "$")(1) = Split(a.Address, "$")(1) Then
bla = True
Exit For
End If
Next a
If bla = False Then
msgcl = Split(cell.Address, "$")(1)
MsgBox "Column Name -------> " & msgcl & " is Hidden"
End If
Next cell
End Sub

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...