code hiding blank columns
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Code for hiding blank columns

Code for hiding blank columns

resolvedResolved · Urgent Priority · Version 2007

replyReply Mon 10 Jan 2011, 10:52 Edited on Tue 11 Jan 2011, 12:30Delegate Siphiwe said...

Siphiwe has attended:
Excel VBA Intro Intermediate course

Code for hiding blank columns

Good Morning

Can you kindly send me a code to hide specific columns on a worksheet but l want.

l have a total of 108 columns, Jan (Actual,Budget,PY) - Dec (A,B,PY), l want to be able to view the current period/month & to hide the rest ...

Many thanks in anticipation!

For upcoming training course dates see: Pricing & availability

replyReply Wed 19 Jan 2011, 10:47Trainer Anthony said...

RE: Code for hiding blank columns

Hi Siphiwe, thanks for your query. I can't really code this for you without see the source data but your main task will be to loop through the column headings performing an If...End If test to see whether the date falls within the current month. If it isn't then set the .hidden property of that column to true. Have a go and see how you get on.

Hope this helps,

Anthony

Tue 25 Jan 2011: Automatically marked as resolved.

 

Please browse our web site to find out more about
vba excel 2007 course and other Microsoft training courses.

Vba tip:

Suspend DisplayAlerts in VBA

To stop Excel asking you things like "Do you want to delete this file...", use the following line of code at the beginning of the relevant VBA procedure:

Application.DisplayAlerts = False

At the end of the procedure make sure you use the following code to reactivate Display Alerts:

Application.DisplayAlerts = True

View all VBA hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard