+ Reply to Thread
Results 1 to 4 of 4

Limiting Views and automatically adding columns

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Limiting Views and automatically adding columns

    I have been asked to set up an excel spreadsheet for one of our departments that holds projected hours for different projects.

    This is the question I was asked:

    Here is the latest version of the spreadsheet. What Jane is requesting is that it show one year at a time - so next month, we'd have February 2013-January 2014. I'm thinking there are a variety of ways to do this. I could even “hide” the months I’m not using if needed, but I’ve noticed this usually messes up the printing for some reason and I have to copy to an email then go in and hide the months for each email when I’m sending that page to folks.
    I have a dummy copy of the spreadsheet attached. Is there some kind of VBA code or macro I can set up to do this?

    Thank you for any help anyone has!
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Limiting Views and automatically adding columns

    Try pasting the following into the ThisWorkbook tab in the VBA editor

    Please Login or Register  to view this content.
    You will need to add an extra column for the current month (December 2102) and extra columns for 2013 and beyond. The code will automatically only show the next year's columns and set the print area accordingly.
    Martin

  3. #3
    Registered User
    Join Date
    12-10-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Limiting Views and automatically adding columns

    I am not sure this is working right. I am probably not setting it up correctly . Can you check to see? I dont' understand about having the next set of columns set up and I am really not used to VBA in Excel, so I am sure this is my mistake somewhere.
    Right now, when I run the macro, it starts doing something that looks very fast. Then it stops, errors, and nothing appears to have changed. I am posting the new spreadsheet with the vba included.
    Attached Files Attached Files

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Limiting Views and automatically adding columns

    Please have a look at the attached. The code should run when the workbook is opened and should therefore make a different set of columns available each month. It's set to use the US date format.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1