LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding Columns Gord Dibben Excel Discussion (Misc queries) 0 February 25th 09 08:49 PM
hiding columns [email protected] Excel Discussion (Misc queries) 3 July 12th 06 04:42 PM
Hiding Columns Squid[_4_] Excel Programming 4 November 12th 04 01:07 PM
Hiding Columns Ruan[_3_] Excel Programming 0 November 13th 03 11:42 PM
Hiding columns in VB Rick B[_4_] Excel Programming 6 November 12th 03 07:22 PM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"