hiding columns

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
I feel a little lost here :oops: and should know this but I can't seem to be able to work out how to hide this column in the routine below.

Dim CELL As Range
For Each CELL In Range("O1:AA1")
If CELL.Value = 0 Then
(Hide this column)
End If
Next
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
On 2002-10-21 23:30, SamS wrote:
I feel a little lost here :oops: and should know this but I can't seem to be able to work out how to hide this column in the routine below.

Dim CELL As Range
For Each CELL In Range("O1:AA1")
If CELL.Value = 0 Then
(Hide this column)
End If
Next

Hi Sam:

I will modify the code to read ...
Code:
...
Dim CELL As Range
  For Each CELL In Range("O1:AA1")
     If CELL.Value = 0 Then
        Cells(1, CELL.Column).Select
        Selection.EntireColumn.Hidden = True
'       (Hide this column)
     End If
  Next
...

Regards!

Yogi
 
Upvote 0
Hi Sam:

I did not see Dragracer's post before I posted mine -- Dragracer's solution is a lot nicer.

Regards!

Yogi

Edit: corrected typo
This message was edited by Yogi Anand on 2002-10-22 15:58
 
Upvote 0
Thanks Yogi, Dragracer's was neat and tidy and did the trick. I tried to use both methods but I'm a little frayed at the moment and everything I tried just was failing. I think I need a holiday. Once again thanks to you both.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top