+ Reply to Thread
Results 1 to 3 of 3

VBA: drop down list for number of columns?

  1. #1
    Registered User
    Join Date
    06-03-2010
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA: drop down list for number of columns?

    I want to create a drop-down list that allows me to select how many columns are presented in the sheet.

    For example, my worksheet is like:
    2007 2008 2009 2010
    a 100 100 100 100
    b 100 100 100 100
    d 100 100 100 100

    In the drop-down list, if 3 is chosen, then 2008, 2009, and 2010 columns are shown;
    if 2 is chosen, only 2009 and 2010 columns are shown;
    if 5 is chosen, then a new 2006 column can be added and so forth.

    How can I write a macro for this please?
    I tried to record a macro; but it doesn't work properly.

    Thank you so much for your help!

  2. #2
    Registered User
    Join Date
    07-03-2008
    Location
    Hyderabad, India
    MS-Off Ver
    2003 and 2007
    Posts
    58

    Re: VBA: drop down list for number of columns?

    Hi Jeff,

    I have created one simple solution for you!!!!

    Its very simple to start macro.

    Steps what i have did:
    1. Added dropdown from insert - dropdown list
    2. Bind the values
    3. Set the selected value in one cell.
    4. Then open the code window (Alt+F11)
    5. Insert module then write one small function.

    Find the attachment.

    I hope it will more useful to U!!!

    Have a good stuff!!!

    Regards,
    Salim
    Attached Files Attached Files
    Salim

  3. #3
    Registered User
    Join Date
    06-03-2010
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA: drop down list for number of columns?

    Hi Salim,

    Thank you so much for your help!
    It's great to have this solution!

    I'll see if i can make some further use of your function here.

    Jeff

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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