hide columns automatically

C

Chicom17

Sheet A & B look like this
Month Jan- Feb -March-April- May -June
Select 1 1 1 0 0 0

If i capture 1 on sheet A it will reflect on Sheet B. I need to atomatically
hide 0 columns on sheet B, and this colums wil automatically show when i
capture 1 on sheet A
 
S

Susan

i don't know what you mean by "capture", but this is what i came up
with. when you activate sheet 2, it automatically checks for zero
values & hides those columns. place the code in the worksheet code
area of worksheet 2. hope it helps!
==============
Option Explicit

Private Sub Worksheet_Activate()

Dim myR As Range
Dim r As Range

Set myR = Range("b2:g2")

For Each r In myR
If r.Value = "0" Then
r.EntireColumn.Hidden = True
End If
Next r

End Sub
===================
susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top