PDA

View Full Version : If any column in active worksheet is hidden, then the value of cell A1 is “hide”.



uktous
02-14-2013, 06:46 PM
Hi,

Could you please write the macro which can perform the following function?

If any column in active worksheet is hidden, then the value of cell A1 is “hide”.

Thanks

lynnnow
02-14-2013, 11:57 PM
Are you looking at the entire set of columns or just a bunch of them?

if you're looking at only a bunch of them, you can try:

Sub ColumnHidden()
Dim rngColumn As Range
For Each rngColumn In Range("B1:Z1").Columns
If rngColumn.Hidden Then Range("A1").Value = "Column " & rngColumn.EntireColumn.Address(0, 0, 1) & " Hidden"
Next
End Sub

HaHoBe
02-16-2013, 10:59 AM
Hi, uktous,

what about Column A being hidden?

Sub WriteToA1()

[A1] = IIf(Rows(1).Cells.Count <> Rows(1).SpecialCells(xlCellTypeVisible).Cells.Count, "Hide", "")

End Sub Ciao,
Holger