Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code to enable a hidden column(C) to be unhidden, should
a certain category in the previous column(B) be chosen. I took that from an online example. However what I trying to achieve without success is the following: I would like column(C) automatically to be hidden again, once the next cell in the next column has been moved to. Any help would be greatly appreciated. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 5 And Target.Value = "Locators" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Detectors" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Survey/Navigation Equip." Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Machinery" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Medical Equip. Cap. Assets" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Weapons" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Desktops" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Laptops" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Printers" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Scanners" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Digital Cameras" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Radios" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Sat Phones" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Mobile Phones" Then Columns("G").Hidden = False ElseIf Target.Column = 5 And Target.Value = "Vehicles" Then Columns("G").Hidden = False End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro or VB code to hide and unhide Label box | Excel Discussion (Misc queries) | |||
Slow VBA code....Hide/Unhide Loop | Excel Worksheet Functions | |||
VB Code to hide and unhide rows | Excel Discussion (Misc queries) | |||
Macro-Hide & Unhide Sheets with condition | Excel Discussion (Misc queries) | |||
Hide/Unhide columns using button on top over relevant columns | Excel Discussion (Misc queries) |