Unhide/Hide a column set together Excel

Hello All,

I am trying to unhide/ hide a set of columns - unhide / hide with an ActiveX checkbox in excel 2007.

Private Sub Info1_Click()
If Info1 = True Then

    Columns("D1:G1").Select
    Selection.EntireColumn.Hidden = False
   
    Else:
    Columns("D1:G1").Select
    Selection.EntireColumn.Hidden = True

End If

End Sub

But this code is giving me errors, any ideas? I have attached the excel file.

Thank you
R
Nextbutton-r12.xlsm
RayneAsked:
Who is Participating?
 
Tommy KinardConnect With a Mentor Commented:
I got this to work

Private Sub Info1_Click()
    If Info1 = True Then
        Columns("D:G").EntireColumn.Hidden = False
    Else
        Columns("D:G").EntireColumn.Hidden = True
    End If
End Sub
0
 
gplanaCommented:
Hi. Which errors are you getting ? I think this could help to solve the problem.

Thanks.
0
 
RayneAuthor Commented:
Hello

I get this Run-time Error 1004.

Debugging highlights this line;

Columns("D1:G1").Select
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
RayneAuthor Commented:
Any guess??
0
 
RayneAuthor Commented:
Thanks Dragon, mush appreciated
0
 
RayneAuthor Commented:
i meant much ;)
0
 
Tommy KinardCommented:
LOL no reason to be mushy :)

Thanks for the points and the grade!
0
 
RayneAuthor Commented:
no problem :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.