+ Reply to Thread
Results 1 to 6 of 6

Need VBA to add month/year column and delete month/year column

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

    Need VBA to add month/year column and delete month/year column

    I have a situation in excel and I have no idea where to start with writing the VBA code.

    This is what I have been requested to do:

    It is a spreadsheet with columns for the months of the year. I was asked that the spreadsheet show one year at a time - so when a month changes, so do the columns. When February 2013 is showing, all the months will show up until January 2014. The month after would be March 2013 up to February 2014.

    I usually work in databases, but I don't see that working for this. Also, there are some formulas in this spreadsheet. They are not complicated. They just add up hours for different employees on different projects.

    It seems to me that there should be some sort of coding that can do this for the user.

    Does anyone have any ideas?

    Attached is a copy.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-17-2012
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Need VBA to add month/year column and delete month/year column

    Let me verify what you're asking. You're saying that you want cells D1:N1 to change based on the month in cell C1? How does the cell in C1 change? Will it be the current month or will users change it manually?

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

    Re: Need VBA to add month/year column and delete month/year column

    I want the display to automatically show one year of months. So, if the user deletes, say column C, then the another column shows up after the last one.
    Column C is deleted (January - 2013) and a new column appears after December 2013 (January - 2014). This should continue eveytime a column is deleted. When the column for February 2013 is deleted, a column for February 2014 should show up.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Need VBA to add month/year column and delete month/year column

    Try this. I assumed only column C will be deleted each time.

    Please Login or Register  to view this content.
    Last edited by stnkynts; 12-20-2012 at 06:52 PM.

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

    Re: Need VBA to add month/year column and delete month/year column

    Now for the super embarrasing question:

    How do I make this run?

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

    Re: Need VBA to add month/year column and delete month/year column

    Wait! I totally get it!

    IT WORKS!!!!!

    I am going to show it to my user now.

    THANK YOU!!!!

+ 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