LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Hiding Columns

I am sure this si very simple but its one of those days.

I am trying to automatically hide columns based on a value/switch I
have the following VB:

Public Sub MyHide()

Application.ScreenUpdating = False

Dim cell As Range
For Each cell In Range("3:3")
If cell.Value = "1" Then
cell.EntireColumn.Hidden = True
End If
Next cell

Application.ScreenUpdating = True

End Sub

Which works - however its very slow as it check every single cell on
row 3 also if I run the macro again with hidden rows no longer
equaling 1 I need it to unhide them.


So basically I am trying to upgrade the above VBA to - Hide all
columns after the first "1" is found in row 3 and if it is hidden and
not a "1" to be unhidden - and if it helps if its not to be hidden it
will be a "0" and it will be everything left of the first 1.

so basically a macro that finds the first 1 on row 3 and hides
everything to the right and unhides everything to the left is exactly
what I need - if you can help me ill be most grateful.

 
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 SnareHiHat Excel Discussion (Misc queries) 2 October 16th 09 02:10 PM
Hiding Columns Gord Dibben Excel Discussion (Misc queries) 0 February 25th 09 08:49 PM
Hiding Columns belony Excel Discussion (Misc queries) 4 June 15th 05 12:27 AM
Hiding columns scottwilsonx[_10_] Excel Programming 4 July 26th 04 01:23 PM
Not Hiding Columns SS[_3_] Excel Programming 1 February 11th 04 10:27 PM


All times are GMT +1. The time now is 03:40 PM.

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"