Hi,
Not sure why this is happening. I have buttons located on column N and Column X. They show and hide Columns O-Q and Y-AG, respectively. I thine have code in the sheet to expand columns when activated so that the user can clearly read the choices in the data validation list. However, now that I added that second code to columns N-AG, it unhides the respective sections again. Can this be fixed? Also if there is a short cut for my expanding column code for these columns, that would also be appreciated! Thanks!
Thanks for any help in advance!!
Not sure why this is happening. I have buttons located on column N and Column X. They show and hide Columns O-Q and Y-AG, respectively. I thine have code in the sheet to expand columns when activated so that the user can clearly read the choices in the data validation list. However, now that I added that second code to columns N-AG, it unhides the respective sections again. Can this be fixed? Also if there is a short cut for my expanding column code for these columns, that would also be appreciated! Thanks!
Code:
Private Sub CMD_1Click()
[INDENT]With columns("O:W")
[INDENT]If .Hidden Then
.Hidden = False
Else
.Hidden = True
End if
[/INDENT]End With
End Sub
[/INDENT]Private Sub CMD_2Click()
[INDENT]With columns("Y:AG")
[INDENT]If .Hidden Then
.Hidden = False
Else
.Hidden = True
End if
[/INDENT]End With
End Sub
[/INDENT]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 5 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (5).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 6 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (6).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 7 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (7).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 12 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (12).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 13 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (13).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 14 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (14).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 15 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (15).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 16 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (16).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 17 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (17).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 18 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (18).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 19 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (19).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 20 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (20).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 21 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (21).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 22 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (22).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 23 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (23).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 24 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (24).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 25 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (25).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 26 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (26).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 27 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (27).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 28 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (28).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 29 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (29).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 30 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (30).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 31 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (31).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 32 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (32).ColumnWidth = 17
[/INDENT]End If
[/INDENT]If Target Count >1 then Exit Sub
[INDENT]If Target.Column = 33 Then
[INDENT]Target.Columns.ColumnWidth = 40
[/INDENT]Else
[INDENT]Columns (33).ColumnWidth = 17
[/INDENT]End If
[/INDENT]End Sub
Thanks for any help in advance!!