+ Reply to Thread
Results 1 to 7 of 7

VBA Copy&Paste Loop under sertain conditions

  1. #1
    Registered User
    Join Date
    03-15-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Question VBA Copy&Paste Loop under sertain conditions

    Hi forum,

    I am really new to VBA and I need to create a macro far beyond my skill and hit a brick wall;

    I think I need many layers of loop, but if there's more elegant way please teach me.

    I basically need to repeatedly copy&past store named "x" amount of time based on PO instruction conditioned by Grade and Zone type.

    Please check the attached file for more info.

    Many thanks in advance,

    Cheers!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA Copy&Paste Loop under sertain conditions

    what determines the Grade/zone

    PARRAMATTA A T
    STRATHFIELD A T

    they both are A and T
    is there something else that works it out?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    03-15-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA Copy&Paste Loop under sertain conditions

    Thanks for replying!

    Yep, that simply mean both stores have same grade and zone type.

    So if the PO# 2001515 instruction is All zone type A-5 B-3 C-1;

    It means copy and paste any stores that are in any zone type and grade A 5 times then do the same for B grade 3 times then do the same for C grade 1 time.

    The result is [Output Example] tab

    Cheers,

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA Copy&Paste Loop under sertain conditions

    I assume the PO# will be the activecell before running the macro? Is that correct?

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA Copy&Paste Loop under sertain conditions

    you were right
    many layers of loops was the only way i could think to do it

    mainly because the way you have the output

    have a look at the attached to see if it does what you are after
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-15-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA Copy&Paste Loop under sertain conditions

    I am really sorry for not coming back to this.


    But I decided to take a different approach and solved this issue.

    Thanks everyone for your replies - Especially, humdingaling.

    Your reply taught me a lot!

    Cheers,

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: VBA Copy&Paste Loop under sertain conditions

    not a problem

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. copy paste row if conditions are met
    By SSJAMES18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2015, 10:48 AM
  2. VBA to copy and paste according to conditions
    By andrewc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2014, 09:19 AM
  3. [SOLVED] Destination copy and paste (values only) for copy loop
    By mr_mango81 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2013, 08:59 PM
  4. [SOLVED] Copy Paste Loop ends before copy/paste is finished
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2013, 04:01 PM
  5. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 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