+ Reply to Thread
Results 1 to 6 of 6

Duplicate a Box depending on how many rows another tab has.

  1. #1
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Duplicate a Box depending on how many rows another tab has.

    I need a macro to duplicate a box i have in a sheet depending on how many rows the other tab has. In this example file ive included the macro i have now. With this macro i select A1 : R23 and press ctrl shift d, it asks me how many duplicates i want and i enter the number based from how many the test2 tab has. I would like a macro to read how many rows the test2 tab has and then automatically duplicate the box that many times . In other words automate it, instead of me having to enter the number ( this number changes depending on the file i have ).

    Ive included a test file with intructions and my current macro, i have 2 tabs which need to be looked at.


    Thanks for any help.
    Attached Files Attached Files
    Last edited by donnydorko; 11-16-2009 at 04:30 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: Macro Needed To Duplicate a Box depending on how many rows another tab has.

    Try this:
    Please Login or Register  to view this content.
    You may need to reattach the CTRL-D to it after you replace the code. It acted odd for me until I did that. (Alt-F8, select, OPTIONS)
    _________________
    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
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Macro Needed To Duplicate a Box depending on how many rows another tab has.

    works perfectly but i still have to highlight the box A1:R23, i would rather it automatically duplicate the box , in otherwords that range instead of me highlighting it.

  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: Macro Needed To Duplicate a Box depending on how many rows another tab has.

    You want that hardcoded now?

    What about if it's been run already, do you want it to clear the rows below the box range and reapply the new "number of rows needed"?

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

    Re: Macro Needed To Duplicate a Box depending on how many rows another tab has.

    Maybe:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-25-2009
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    177

    Re: Duplicate a Box depending on how many rows another tab has.

    works like a charm, thanks sir

+ 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