ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Hide-Unhide Columns with a macro (https://www.excelbanter.com/excel-discussion-misc-queries/133962-re-auto-hide-unhide-columns-macro.html)

Jim Thomlinson

Auto Hide-Unhide Columns with a macro
 
Give this a whirl...

Sub HideUnhideColumns()
Dim rngToHide As Range

On Error Resume Next
Set rngToHide = ActiveCell.EntireRow.SpecialCells(xlCellTypeBlanks )
On Error GoTo 0

If Not rngToHide Is Nothing Then
ActiveSheet.Cells.EntireColumn.Hidden = False
rngToHide.EntireColumn.Hidden = True
End If
End Sub

--
HTH...

Jim Thomlinson


"Ed" wrote:

Hello,
I have a table from A1:EG70 that looks like a checkerboard, not all cells
have info in them. Does anyone know a macro to auto hide the empty columns
within the active row? The idea is to have visible only the columns with info
while browsing vertically the different entries.

thanks!


Ed

Auto Hide-Unhide Columns with a macro
 
Jim, I couldn't make it to work, I don't know if I needed anything special to
make it work. I put it into "ThisWorkbook" inside VBA and into a Module and
so on but I can't get it to work. Do you have any idea why that could be?




All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com