+ Reply to Thread
Results 1 to 3 of 3

Macro - how can replicate only a number of times...

  1. #1
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Macro - how can replicate only a number of times...

    Hi,

    Please see attached workbook. Can you help me fix this macro. I wanted to do the following..
    As you can see, at the moment the macro is written so it pasts 10 items from the third tab "Order Details".
    Its also picking up items from the order summary, which is also accurate.
    So lets say there's only two items instead of ten on the third tab.
    How can this macro can be fixed so it only replicates in an instance like that, it only copies company ABC twice, and only 2 items?
    Can you please help?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-27-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: Macro - how can replicate only a number of times...

    Hi Celeazul,

    Check for the null value and exit from the for loop.

    Update the statement:

    For i = 1 To 10
    'Copy Order Details to Transactional Report
    'Row Offset to next item

    If Sheets("Order Details").Range("B" & NextAmount) = "" Then Exit For


    Regards,
    lokicl

    Remember To Do the Following....

    1. Use code tags. Place CODE before the first line of code and CODE after the last line of code.
    2. Thank those who have helped you by clicking the Star * below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro - how can replicate only a number of times...

    [SOLVED]
    Thank you so lokicl much it worked. You're the best!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro - Repeat macro a specific number of times
    By uvinduds in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2013, 02:42 PM
  2. Run macro specified number of times (specified by user)
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 12:02 PM
  3. [SOLVED] Creating number pattern to replicate 24h time
    By thetalldude in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-13-2012, 05:04 PM
  4. Excel VBA Macro to keep track of number of times the macro run.
    By vijay21 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2012, 02:13 PM
  5. [SOLVED] Macro to show how many times one number appears with another number
    By Omega71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2012, 10:53 AM
  6. replicate a number of cells
    By alisam in forum Excel General
    Replies: 5
    Last Post: 11-22-2011, 11:27 AM
  7. Macro to replicate a line and values multiple times
    By cheddarthief in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2011, 01:32 PM
  8. How to run a Macro specified number of times?
    By brutonparish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2006, 11:50 PM

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