+ Reply to Thread
Results 1 to 9 of 9

Copy Row macro modification needed

  1. #1
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Copy Row macro modification needed

    Hey everyone. I was wondering if someone could help me with this problem. I have a macro that copies rows and it does a great job, however, I need to modify it as follows: I need the macro to copy to a different column(other than A). Ideally, I would like the copied cells(Column A:D) to be copied over to Column I:L starting at row 31 and then advancing downward(this is where I am having problems). I have made several attempts to do this, but have been unsuccessful. Thanks in advance!
    Please Login or Register  to view this content.
    Last edited by alansidman; 08-26-2017 at 09:15 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,012

    Re: Copy Row macro modification needed

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Copy Row macro modification needed

    How about this ?

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Copy Row macro modification needed

    If I could bother you once more. BTW:Your above code worked beautifully! I have another macro that interacts with the copy macro listed above and I was wondering if you could tweak it as well. Here is a look at the code:
    Please Login or Register  to view this content.
    As written, the checkboxes are placed to the far right side of the row that is being copied. In my sheet the checkboxes are placed in column C. I want to also place the checkboxes in Column F and Column I starting at row 31. Can this be done? Thanks!

    Also, I notice that as the rows are copied over to Column I, they stay on the same row that they came from instead of starting off at I31 and advancing down to I32,I33,etc. Can that problem be solved as well?
    Last edited by darbar76528; 08-26-2017 at 10:14 PM.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Copy Row macro modification needed

    This should solve the row issue and also start in correct Column.
    Please Login or Register  to view this content.

    But in that case your Checkboxes will be over Column I data. Is that correct ?
    Last edited by bakerman2; 08-26-2017 at 10:43 PM.

  6. #6
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Copy Row macro modification needed

    To better convey what I am trying to accomplish, I have attached a file to assist. The first random checkbox, once selected, and the button "copy selected rows" is pressed, should copy the two cells located to the immediate left to L32:M32. The next checkbox selected would populate in L33:M33 and so forth.

    In other words, if I select the checkbox in F37 and then hit the "copy selected rows" button, it should copy cells D37 and E37 to L32 and L33. If I then or also selected checkbox I53 and hit the "copy selected rows" button, it should place cells G53 and H53 into cells L33:M33 and so forth...

    If I select 10 different options, the 10 options should populate, one after the other in L32:M41

    Hope this helps.
    Attached Files Attached Files
    Last edited by darbar76528; 08-26-2017 at 11:36 PM. Reason: addl. comment

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Copy Row macro modification needed

    No need for extra button. When a checkbox is ticked to True then values are copied to other range.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: Copy Row macro modification needed

    Your solution to this is superb! I will study the coding to figure out how this actually works. I want to thank you so much for your help with this problem.
    Sincerely

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Copy Row macro modification needed

    You're welcome and thanks for rep+.

+ 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] Slight modification needed, delete row if word found
    By fantom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2014, 07:20 AM
  2. [SOLVED] Modification Help Needed 649 Combination Generator Code
    By ssjagger in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-05-2013, 08:52 PM
  3. Macro modification needed
    By mdsickler in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-09-2011, 02:11 AM
  4. help needed for this little modification
    By ttik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2009, 12:20 AM

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