Reputation: 45
I have a VBA question that I have been struggling to answer. In a spreadsheet, I have several columns that I have hidden (A:O). I'd like to find the first visible column of the worksheet (in this case column P) and get that column number for calculation purposes. Does anyone know how to achieve this? This should be pretty straightforward, but I can't seem to wrap my head around how to do so. Thanks!
Upvotes: 0
Views: 906
Reputation: 35853
Following code prints number of first visible column:
MsgBox Range("1:1").SpecialCells(xlCellTypeVisible).Column
Upvotes: 6