ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide columns automatically (https://www.excelbanter.com/excel-programming/412723-hide-columns-automatically.html)

Chicom17

hide columns automatically
 
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

Susan

hide columns automatically
 
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



On Jun 17, 9:15*am, Chicom17
wrote:
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




All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com