+ Reply to Thread
Results 1 to 12 of 12

Alter existing formula to copy specific cells in row instead of copy entire column

  1. #1
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Alter existing formula to copy specific cells in row instead of copy entire column

    I received some wonderful help here recently and was hoping for a bit more. I believe what I'm trying to do is similar to the help I received the other day, but I'm having an awful time trying to alter that macro to suit this new need.

    I need the macro to look at cells B9:B84 on the Sheet1 tab of the Cost Template. If it finds an x I need it to copy the 3 cells to the right of the x and paste them in a template. For example if it sees an x in cell B9 it would copy cells C9, D9 and E9, open the Purchase Order to the Detail tab, then paste it to cells B3, C3 and D3. It would continue looking for an x down to B84. So if it found 5 cells with x, it would give me 5 instances of the Purchase Order with 3 cells pasted into each.

    I've attached my Cost Template and the Purchase Order it needs to copy to. In the Cost Template is a macro called Create_PO. This is what I was trying to alter to make this happen. I can't seem to get it right! FYI in case it matters, I had to change the Cost Template from .xltm to .xlsm in order to upload it on this site.

    I am happy to answer any clarification questions & even happy to pay for any assistance with this! It is driving me batty, but I love learning more about macros from you wonderful people!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Untested code.
    Attached Files Attached Files
    Last edited by AB33; 05-01-2014 at 04:21 PM.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Change this line to suit your needs.
    This is my own folder, you need to change it where you save the purchase order sheet
    Attached Files Attached Files
    Last edited by AB33; 05-01-2014 at 04:14 PM.

  4. #4
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Hi AB33. I very much appreciate your reply & your efforts! I just took a quick peek & this might be just what I need. I won't be at my computer with the forms again until morning, but I will test it first thing. I soooo much appreciate your help. I clicked the 'add reputation' button to give you good feedback and will mark this as solved as soon as I get to test it properly. You are the best! This is a great forum.

  5. #5
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Hi AB33. This is almost what I had in mind. Your macro puts them all into a single instance of my template. I actually need it to put each 3 column entry into an individual instance of the template. So if I had 3 Xs I would get 3 templates, each with the 3 columns to the right of the x in it. I need it to create a separate PO for painting, a separate PO for ceramic tile, etc. That is what I'm having a hard time figuring out how to write. Any help would be greatly appreciated!

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Please show me the out put in a sample. What are 3 templates? Do you want you want to create 3 sheets?
    When the code finds, x, it copies 3 columns to the right and put them in to next empty row in column B of the same sheet.

  7. #7
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    I think I didn't explain it very well. There are no additional forms that I haven't uploaded. The 3 templates I mentioned are 3 instances of the same template, the Purchase Order. The code would find an x at B24 on the Cost Template, copy C24:E24, and paste it to the PO. Then it would find the next x in B25 of the Cost template, copy C25:E25, and paste it into a new blank instance of the same PO. Repeat. In the end if there were 3 Xs on the Cost Template, I would have 3 Purchase Orders. One would contain C24:E24, one would contain C25:E25, and one would contain C26:E26. Thank you again!

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Still not sure I am getting it!
    All I see is there are 2 sheets in the PO sheet, sheet Quote and sheet Detail. The codes copies Column C-E in to sheet Detail.
    Did you check my post 3? What is wrong and what should be changed?

  9. #9
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    I'm really not good at explaining it. Attached is what the output would be. There are 3 Xs in the attached Cost Template, which would result in the attached 3 POs.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    I forgot to say if there were 5 Xs, it would make 5 POs, etc.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    Okay!
    Where are these 3 PO? Are not they are 3 different books? Or are they 3 sheets on the same book?

  12. #12
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Alter existing formula to copy specific cells in row instead of copy entire column

    I have a folder that contains both the Cost Template and a single blank Purchase Order. I want it to open a new copy of that Purchase Order for each X. There are not 3 different Purchase Orders for it to work with, just 1 Purchase Order workbook that will need to be opened 3 times with different data in each.

    The code that does something very similar is functioning well, if you want to see what I mean in action. In my original post I uploaded a Cost Template & a Purchase Order. (Make sure to save both of these in the same folder or it won't work.) Open the Cost Template & put an x in cells AA1 and AB1. Then run the macro called Create_PO. It will copy column AA and paste it to the Purchase order, then it will copy column AB and paste it into a new instance of the Purchase Order. It saves both POs in the same folder and names then something like Column37 and Column38.

    I'm looking to do the same thing on Sheet1, except instead of copying a whole column, it will just copy those 3 cells to the right of the x. I just can't figure it out.

    I hope this makes sense. I wish I could explain it better, but I'm pretty new at this & still working on the right terminology. Thanks for your patience & trying to work through this with me.

+ 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] Copy and paste cells of relative position ,then copy to others w'o alter
    By lokwungkwung in forum Excel General
    Replies: 14
    Last Post: 10-29-2013, 01:09 PM
  2. [SOLVED] Copy entire row from one sheet to another if cells in column A are equal
    By Scal in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-12-2013, 12:27 PM
  3. Need to add value of 1 to consecutive cells entire column BUT copy too
    By SLINDSAY in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-19-2013, 09:07 AM
  4. Replies: 7
    Last Post: 01-09-2013, 02:28 PM
  5. Need to copy specific cells into an existing worksheet based on date entered by user
    By jrfleury in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2011, 09:44 AM

Tags for this Thread

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