Is cell in hidden column?

QB

Board Regular
Joined
Jul 5, 2004
Messages
92
Hi

I want to cycle through a range of cells - E10 to P10 say - to find whether the cell address is in a hidden column. Is there an easy way to do this?

Thanks

QB
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,764
Something like this?

Code:
Sub Test()

Dim cell As Range

For Each cell In Range("E10:P10")
    If cell.EntireColumn.Hidden = True Then MsgBox cell.Address & " is in a hidden column"
Next
End Sub
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
10,687
Office Version
2019
Platform
Windows
In a formula (based on E10 as the start, autofill down to move to next column)

=ADDRESS(10,ROW(5:5))&IF(CELL("Width",INDIRECT(ADDRESS(10,ROW(5:5))))>0," Not Hidden"," Hidden")

In VBA

Code:
For Each mycell In Range("E10:P10")
If mycell.EntireColumn.Hidden = True Then
MsgBox mycell.Address & " is hidden"
End If
Next
Does that give you enough to build on as needed?
 

QB

Board Regular
Joined
Jul 5, 2004
Messages
92
Thanks, jasonb75 and njimack. Just what I needed.

QB
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,605
Messages
5,512,376
Members
408,889
Latest member
2vbr

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top