Hi.
Can u guys help me with changing a litle bit this macro code? It's works but when I try to change it for multiple IF nothing happend..
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End SubI need to use it with multiple cell value in cell B1 (filtering list) for hidding selected columns. For example when B1 = SKD I wanna hide column C; when B1 = CCTV I wanna hide column D, and unhide C; when B1 = SKD+CCTV I wanna have everything unhide. How can I merge it all into one macro code?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = CCTV Then
Columns("D").EntireColumn.Hidden = True
Else
Columns("D").EntireColumn.Hidden = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD+CCTV Then
Columns("E").EntireColumn.Hidden = True
Else
Columns("E").EntireColumn.Hidden = False
End If
End Sub</pre></pre>
Can u guys help me with changing a litle bit this macro code? It's works but when I try to change it for multiple IF nothing happend..
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End SubI need to use it with multiple cell value in cell B1 (filtering list) for hidding selected columns. For example when B1 = SKD I wanna hide column C; when B1 = CCTV I wanna hide column D, and unhide C; when B1 = SKD+CCTV I wanna have everything unhide. How can I merge it all into one macro code?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD Then
Columns("C").EntireColumn.Hidden = True
Else
Columns("C").EntireColumn.Hidden = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = CCTV Then
Columns("D").EntireColumn.Hidden = True
Else
Columns("D").EntireColumn.Hidden = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B1").Value = SKD+CCTV Then
Columns("E").EntireColumn.Hidden = True
Else
Columns("E").EntireColumn.Hidden = False
End If
End Sub</pre></pre>