0
votes

I try to unhide columns using this:

Range(Target, Target.SpecialCells(xlCellTypeLastCell)).EntireColumn.Hidden = False

Only columns A and B in the sheet are visible, others - hidden, although there are values entered in A:K. Target can be any cell in column A (this is a snippet from an event code).

How to unhide cells?

1
Can you pls explain further what you are trying to do?brettdj
Well, I was trying to unhide columns, but only those which are actually used (A:K)- UsedRange or xlCellTypeLastCell should work for that. First I tried the latter, but obviously that does not work and I don't know why.When I debug, I see that xlCellTypeLastCell refers to a cell in B column. However, I have achieved what I wanted by employing UsedRange which does not ignore hidden columns.ZygD

1 Answers

0
votes

I have achieved what I wanted by employing UsedRange which does not ignore hidden columns. The code could be:

ThisWorkbook.ActiveSheet.UsedRange.EntireColumn.Hidden = False

I actually used this (as the code is in a worksheet module):

Me.UsedRange.EntireColumn.Hidden = False