Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

code hiding blank columns

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

Code for hiding blank columns

ResolvedVersion 2007
Edited on Tue 11 Jan 2011, 12:30

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!

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.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

VBA tip:

Add A New Sheet at the end of the Workbook

To add a new sheet at the end of the workbook you need to count the sheets in the workbook using:

Sheets.Count

Then use this value as the rank of the sheet after which you want to add the new sheet:

Sheets.Add After:=Sheets(Sheets.Count)

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.