+ Reply to Thread
Results 1 to 7 of 7

autofill with max value specified

  1. #1
    Registered User
    Join Date
    11-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    autofill with max value specified

    Hello,

    I am trying to simplify my data entry and I have this idea that I do not know how to tackle, but it would be nice to have it worked out.
    I am looking for an autofill macro that will fill column B2 to Bxx with values from 1 to max value specified in cell B1. Lets say I know I have 5 trees I need to enter. I want to enter "5" in a cell as a reference, and everything else will be filled in automatically with press of the button.

    To make things even more productive I would like to use value from cell A2 and replicate it through the range specified above in column A2:Axx.

    Result:
    ______ColumnA________ColumnB
    Row1__[somevalue]_____[5] <<<< values specified by me.
    Row2__somevalue_______1
    Row3__somevalue_______2
    Row4__somevalue_______3
    Row5__somevalue_______4
    Row6__somevalue_______5


    Any ideas? Sorry about elaborate diagrams but I really had a hard time verbalizing what I need - thus no google answer...

    Thanks
    Radek
    Last edited by radex7; 11-05-2009 at 09:47 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: autofill with max value specified

    Try this:
    Please Login or Register  to view this content.
    =============
    How to use the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use.

    1) Put a value in A1
    2) Put a number B1
    3) Press Alt-F8 and select the macro from the list.
    Last edited by JBeaucaire; 11-03-2009 at 09:34 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: autofill with max value specified

    JBeaucaire, just plugged it in and tested - it ran beautifully - you rock - THANK YOU!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: autofill with max value specified

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].


    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated)

  5. #5
    Registered User
    Join Date
    11-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: autofill with max value specified

    Thanks again. I came across a little glitch, that you will prob. figure out in no time... When I provided an example I provided a simplified spreadsheet hoping to update the macro accordingly. In fact, I am using other macro for this sheet to load up the data to Access, which requires fixed cell parameters (column headers are in row 3). I tried to change cell address' so they correspond to my data sheet, but the result was truncated by 2 rows. Here is the actual design of my sheet, problem remains still the same:

    ______ColumnA________ColumnB________ColumnC
    Row1__instructions_____macro buttons
    Row2__[somevalue]____[4]<<<<values specified by me (category, tree count)
    Row3__header1________header2________header3
    Row4__somevalue______1
    Row5__somevalue______2
    Row6__somevalue______3
    Row7__somevalue______4

    Do you think it is doable? Thanks in advance...

    Radek

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: autofill with max value specified

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: autofill with max value specified

    Thanks again, JBeaucaire. First post updated.

+ 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