USMCBBrady
03-16-2005, 05:37 PM
Hi all.
I'm currently working on an Excel book that allows users to select, via checkboxes, what columns will be visible in another sheet. I did some initial code a while back and seemed to have it, but when I made some code today, the sheet in question (the one with the hidden columns) 'freezes' for lack of a better term. It ends up at column M, and I can't scroll right. Below is the code.
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Application.ScreenUpdating = False
Application.Goto reference:="aetnaplan2"
Selection.EntireColumn.Hidden = False
Sheets("Plan Selections").Select
Application.ScreenUpdating = True
Else
Application.ScreenUpdating = False
Application.Goto reference:="aetnaplan2"
Selection.EntireColumn.Hidden = True
Sheets("Plan Selections").Select
Application.ScreenUpdating = True
End If
End Sub
I'm sure this is a completely noob question, but I just can't seem to figure out the syntax. I've got code that unhides/hides entire sheets and rows, based on checkbox selections and such, but this is throwing me for a loop. Please either reply here or my work email at bryan@ddanzig.com. Your help is greatly appreciated as I begin my exploration into VBA.
Sincerely,
Bryan Brady
I'm currently working on an Excel book that allows users to select, via checkboxes, what columns will be visible in another sheet. I did some initial code a while back and seemed to have it, but when I made some code today, the sheet in question (the one with the hidden columns) 'freezes' for lack of a better term. It ends up at column M, and I can't scroll right. Below is the code.
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Application.ScreenUpdating = False
Application.Goto reference:="aetnaplan2"
Selection.EntireColumn.Hidden = False
Sheets("Plan Selections").Select
Application.ScreenUpdating = True
Else
Application.ScreenUpdating = False
Application.Goto reference:="aetnaplan2"
Selection.EntireColumn.Hidden = True
Sheets("Plan Selections").Select
Application.ScreenUpdating = True
End If
End Sub
I'm sure this is a completely noob question, but I just can't seem to figure out the syntax. I've got code that unhides/hides entire sheets and rows, based on checkbox selections and such, but this is throwing me for a loop. Please either reply here or my work email at bryan@ddanzig.com. Your help is greatly appreciated as I begin my exploration into VBA.
Sincerely,
Bryan Brady