Home |
Search |
Today's Posts |
#1
|
|||
|
|||
hiding columns automatically
I have a number of columns on a spreadsheet that need not be viewed or
printed if a given field within that range is zero. I am lloking for syntax that will automatically hide (say) columns a to f where the value in (say) c20 is less than 1? I have macro that closes the columns if I select them manually but given volumes need to do this automatically. Any ideas Thanks |
#2
|
|||
|
|||
Something like this perhaps? You will have to assign it to a button or run it
from the macro dialog. Sub HideAtoF() If Range("C20").Value < 1 _ Then Range("A:F").Columns.EntireColumn.Hidden = True End Sub tj "dave glynn" wrote: I have a number of columns on a spreadsheet that need not be viewed or printed if a given field within that range is zero. I am lloking for syntax that will automatically hide (say) columns a to f where the value in (say) c20 is less than 1? I have macro that closes the columns if I select them manually but given volumes need to do this automatically. Any ideas Thanks |
#3
|
|||
|
|||
hi,
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("C20").Value = 0 Then Columns("A:F").EntireColumn.Hidden = True Else Columns("A:F").EntireColumn.Hidden = False End If End Sub -----Original Message----- I have a number of columns on a spreadsheet that need not be viewed or printed if a given field within that range is zero. I am lloking for syntax that will automatically hide (say) columns a to f where the value in (say) c20 is less than 1? I have macro that closes the columns if I select them manually but given volumes need to do this automatically. Any ideas Thanks . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hiding columns automatically | Excel Discussion (Misc queries) | |||
making columns automatically turn numbers into negatives | Excel Worksheet Functions | |||
Hiding columns based on user/password | Excel Worksheet Functions | |||
Columns in Excel will not allow user to click in them | Excel Discussion (Misc queries) | |||
Counting the Contents of Two Columns | Excel Discussion (Misc queries) |