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 calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
On 2002-10-22 00:02, Dragracer wrote:
Hi Sam
The line your looking for is

CELL.EntireColumn.Hidden = True

That's it, many thanks :)
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
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
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
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
 

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
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.
 

Forum statistics

Threads
1,143,617
Messages
5,719,736
Members
422,242
Latest member
hishamkhatri

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
Top