+ Reply to Thread
Results 1 to 4 of 4

Adding n number of columns

  1. #1
    Registered User
    Join Date
    10-06-2009
    Location
    Skovde
    MS-Off Ver
    Excel 2007
    Posts
    6

    Adding n number of columns

    We're faceing a problem when trying to create a macro that will copy n number o columns. We would like to give the user the opportunity to fill in how many "products" he/she in a cell and that number should be equal to how many columns that are to be copied from our original one.

    The code for 2 columns is something like:

    Range("I5").AutoFill Destination:=Range("I5:J5"), Type:=xlFillDefault

    and we would like to have it something like:

    Range("I5").AutoFill Destination:=Range("I5:'filled in number'5"), Type:=xlFillDefault

    Is this possible in some way?

    Thanks

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

    Re: Adding n number of columns

    Try

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    10-06-2009
    Location
    Skovde
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Adding n number of columns

    Thanks, it works partly as we would like to have it.

    The thing is that we let the user type in the number of columns wanted in cell H3, and we would like to convert that number in some way to be equal the number of copied columns instead of having the InputBox asking for the number.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Adding n number of columns

    See if this is what you have in mind.
    Please Login or Register  to view this content.
    J
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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