![]() |
hiding columns
I am using the following code to hide columns, However, it keeps errorring
our on Column 35. If I delete column 35, it still errors out on column 35. Any suggestions? Thanks. The error message is as follows: Run_Time Error 1004 "Unable to set the Hidden property of the Range class" Sub HideColumns() Dim X As Integer Dim EOF As Integer EOF = 0 EOF = Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column For X = 2 To EOF If UCase(Cells(5, X).Value) = "NO" Then Cells(5, X).EntireColumn.Hidden = True Next X End Sub Thanks for the help..... Sub UnHideCols() Dim X As Integer Dim EOF As Integer EOF = Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column For X = 2 To EOF If Cells(5, X).EntireColumn.Hidden = True Then Cells(5, X).EntireColumn.Hidden = False Next X End Sub -- JT |
All times are GMT +1. The time now is 10:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com