+ Reply to Thread
Results 1 to 20 of 20

Select cell based on value, copy row of select cell and paste into rows in other workbook

  1. #1
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Select cell based on value, copy row of select cell and paste into rows in other workbook

    I am seeking to transfer information from one workbook to another workbook.


    I am seeking it to
    - Look at the 'Practice PEFF' workbook
    - Use column F17:F40 and pick the first cell with a value of "1".
    - From that cell, select data from the row, I would like to copy cells(H:I & L:AA) of the row.

    Open 'EOL 1st Template" and paste the copied cells into each row between F17:F40, that has a value in Column B.

    Thank you for any help or comments leading me to how to accomplish this task.
    Attached Files Attached Files
    Last edited by Ajaxs87; 08-29-2022 at 10:44 PM.

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2504
    Posts
    19,312

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    There are more records in the Practice PEFF workbook, Daily sheet that have a 1 in column F (17), than there are records in the EOL 1st Template workbook, Daily sheet that have a value in column B (8).
    I believe that we are going to need more information in order for someone to be able to help.
    The most useful thing may be to manually fill the cells on the EOL 1st Template workbook, Daily sheet with the expected values so that contributors will have something with which to compare the output of their proposed formulas/code.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Yes, there are more records in Practice PEFF workbook. I might not has been clear in my intent.
    - I want to select just a single record from column F with "1".
    - The "1" is person that had full attendance for the day, so the data in the rest of the row is the full data for a full day.
    - I want to clone that data in that row to each row in the range mentioned in the previous post of EOL 1st Template workbook that has text in it.

    Hopefully this time, I wrote it a bit more clear. My apologizes for any misunderstanding. And thank you for your time.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Quote Originally Posted by Ajaxs87 View Post
    Open 'EOL 1st Template" and paste the copied cells into each row between F17:F40, that has a value in Column B.
    Not clear to me.

    First 1 appears in F17, so copy H17:I17 & L17:AA17 then paste to
    1) Which sheeet?
    2) which cell(s) to be pasted?

    If you explain the steps when you do it manually, it may help to understand how you want it, or you could upload a workbook before/after sheets in order to make it clearer...

  5. #5
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    I used the macro reader to kind of walk through what I am looking for. Hopefully this covers what both of you are suggesting I do. Thank you

    Code is starting off in Practice PEFF workbook

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Are you sure about copy/paste, not paste only value?
    Used paste value due to breaking borders etc.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Jindon
    I used the macro reader for reference, but like you said I only wanted the value of the row. It is working very much in the manner I was looking for! I do run into this one error code, but the function still works even with the error code. I attached a screenshot.
    Attached Images Attached Images

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    I guess it is smoting to do with the macro in "EOL 1st Template.xlsm".

  9. #9
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Thank you for your knowledge and help with this setup Jindon!

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Ajaxs87,
    Try add bold lines
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Thank you! That fixed that error code I was receiving. I did notice one issue, after it completes, it is writing over the formulas in cells J & K in each row it paste into of the EOL Template workbook.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Do you want to paste H:I & L:AA separately?
    The code I posted was based on you recorded macro, so you will need to explain how you want it.

    If you want to paste H:I to H, L:AA to L then
    Please Login or Register  to view this content.
    Last edited by jindon; 08-30-2022 at 08:29 AM.

  13. #13
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    My apologizes, I am still novice to excel and didn't have the understanding to articulate that concept at the time. Thank you for your help once again.

  14. #14
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Hi Jindon,
    I want to thank you for your vba setup! I recent tried to alter this to work with a loop setup in a 2nd excel file. I am having trouble trying to figure out how to write the pathways for the files as they are loop created names that vary. The first code is the one I made to create copies from a template based on if a similar file exist.
    Please Login or Register  to view this content.
    The second code was my failed attempt at altering pathways. I would greatly appreciate any help with wording of the alteration. Thank you

    Please Login or Register  to view this content.
    I attached my other excel file for reference to cells, but most pathways won't be functional for you.
    Attached Files Attached Files

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    First of all, it's a very good practice to declare varialbes even you are not sure about the data types.

    However, all I can understand is that you are calling PEFFCopy when Col E = No Match.
    And your amendment in PEFFCopy doesn't make sense to me.

    So you will need to explain how it should "Loop"...

  16. #16
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Once again, please excuse my ignorance. I will attempt to improve these shortcomings as I improve my knowledge.

    The 1st code works up to calling PEFF Copy

    But more or less, what it does is look into two folders to see what documents exist.
    - If the date in the file names in each of the two folders' doesn't match, then "No Match" in column 5.
    - If "No Match" is present in column 5, it uses PEFF Template and copies the file to a pathway and renames its based on a combination of different columns to generate.
    - It loops down the list, if there are several files with "No Match" to make a filecopy.

    At this point, I have a file with the correct name in the correct folders. This is where I seeked to use your VBA formula, but as the filenames vary based on the 1st code in my last post. I am not sure how to substitute them into the below you wrote prior.
    I bolded some parts in the below code of where I think I am running into a problem.

    Please Login or Register  to view this content.

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    So you need to open/close 2 workbooks each time?

    If so, make it simple
    Create a Template workbook.
    Open \\saims-fs01.sai-llc.local\Dept\2022 PEFF Files\Templates\EOL 1st Template.xlsm
    and save as .xltm
    so that no need to filecopy in the loop.
    When you open .xltm file, it always opens a new copy, so all you need is to save with the full path.

    If not, need more details...

  18. #18
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Thank you for that advice, I will look into that down the road.

    But the file creation side is working in the current state. I am having trouble with the PEFFCopy vba part.
    - In your original, you had it use thisworkbook as the source's path to pull information from. In the new one, it using a string of information from cells as the source's path.
    -Then later you set = wb thisworkbook.path, and in the new setup, it is once again using a string of information from cells to make the path.

    I am having trouble implementing the change from thisworkbook to use these strings of cells instead to find excel files path.

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    still unsure
    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    03-27-2022
    Location
    MS, USA
    MS-Off Ver
    Microsoft 365
    Posts
    149

    Re: Select cell based on value, copy row of select cell and paste into rows in other workb

    Thank you for trying, you are very skilled at the program and I appreciate all you have done.

+ 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] Select Last Cell In A Column, Then Copy/Paste It Down To The End
    By Rick K in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2022, 09:03 AM
  2. Replies: 11
    Last Post: 04-19-2021, 07:46 PM
  3. Replies: 2
    Last Post: 02-06-2016, 10:19 AM
  4. [SOLVED] VBA to Select a Picture Based on Formula in Cell Copy then Paste
    By Bobbbo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2015, 08:38 AM
  5. Macro to select/copy&paste every nth cell in a column or row.
    By anonomeow in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2014, 07:53 AM
  6. Finding last cell in a column, select, copy/paste
    By GaretJjax in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-16-2008, 05:17 PM
  7. Replies: 1
    Last Post: 12-30-2005, 09:35 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