Solved

Unhide/Hide a column set together Excel

Posted on 2012-04-03
8
365 Views
Last Modified: 2012-04-03
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
0
Comment
Question by:Rayne
  • 5
  • 2
8 Comments
 
LVL 15

Expert Comment

by:gplana
Comment Utility
Hi. Which errors are you getting ? I think this could help to solve the problem.

Thanks.
0
 

Author Comment

by:Rayne
Comment Utility
Hello

I get this Run-time Error 1004.

Debugging highlights this line;

Columns("D1:G1").Select
0
 

Author Comment

by:Rayne
Comment Utility
Any guess??
0
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 500 total points
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Rayne
Comment Utility
Thanks Dragon, mush appreciated
0
 

Author Comment

by:Rayne
Comment Utility
i meant much ;)
0
 
LVL 14

Expert Comment

by:Tommy Kinard
Comment Utility
LOL no reason to be mushy :)

Thanks for the points and the grade!
0
 

Author Comment

by:Rayne
Comment Utility
no problem :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Outlook Free & Paid Tools
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now