+ Reply to Thread
Results 1 to 19 of 19

Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new cells

  1. #1
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new cells

    Hi!
    I don't know much about VPA. That is for sure now!
    I have an Excel table with 4 columns (b7:E11): headers: b7="box", c7="color", d7="type", e7="date".
    In range (b3:f3), I have some data that I wish to copy into X number of newly automatically inserted rows in my table. X value (or the number of rows that I wish to insert) is in cell A1.
    I wish to do this by a button click automatically. However, I can't figure out the macro that I have to assign to this button.
    I have been struggling with that for a very long time now. I am desperate and wonder is this something achievable in Excel? May you please help me with that?
    I highly appreciate it!

    Thanks
    Attached Files Attached Files
    Last edited by blue_clouds_mountain; 02-09-2019 at 09:29 AM.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Can you attached sample file, please?
    It could be really helpful to understand you request.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Thanks a looooot you for your reply.
    I uploaded the file

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Connect this to your button:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Thanks for your reply.
    I tried. It's only working for the first entry in column B and inserts only 1 row per clicks. Have I applied it correctly?!
    Is there a way to insert a specified number of rows per click?

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    How about
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    It's perfect! thanks soooooooooooooooo much!
    May you please explain this formula for me? so I know how to manipulate it a bit?
    For example, if I wanted to copy only one entry in cell B3 but not the others C3:E3 to the inserted rows, how can I do that?
    Moreover, is there a possibility to insert the rows anywhere in the table, not only below the last row?
    I can't express my gratitude enough! thank you all!
    Last edited by blue_clouds_mountain; 02-09-2019 at 11:11 AM.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    How would you determine where to insert the new rows?

  9. #9
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    below the active cell

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Try
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Tried. it inserts the rows anywhere in the table. However, it did not copy the values anymore.
    Is there a possibility that I can copy only 2 single entries in cells B3 (box) and E3 (date) to the corresponding columns in the inserted rows, but not the other entries C3 & D3 (COLOR & TYPE)?
    Last edited by blue_clouds_mountain; 02-09-2019 at 11:35 AM.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    It works for me with your test file.

    Can you please decide on what EXACTLY you want, rather than continually "moving the goalposts"

  13. #13
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Thank you for your reply. And sorry for changing goalposts. I will edit my the title of my post so everyone can expect what is in this thread.
    The last code did not work for me. It is only inserts rows with the number I specified in the cell A3, however, the inserted rows are blank. I am just learning and I wish to copy specific data in the inserted rows. The copy source is B3:E3. I want to copy these values so each value, B3 for exemple, can be copied into the column D4 in my inserted rows, or any other column that I specify.
    So, it just inserting a specified number of rows based on a cell, and insert data into each one of these rows based on cells as well.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    So how do you determine which cell to copy & what column/row it should go in?

  15. #15
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Thank a lot Fluff13 for your help. I greatly appreciated.
    I determine it based on the headers of my table. so, for example, the value on cell B3 goes to the column which is called box, and e3 goes to the column called color... etc

  16. #16
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    That's what the code in post#10 does.
    Select any cell in the table & run that code.
    It will insert new rows below the active cell & insert the contents from B3:E3 into those rows

  17. #17
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Yes, it does. It looks I did a mistake before even I tried it several times! Anyway, it works for me now! Thanks a lot!

  18. #18
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    You're welcome & thanks for the feedback

  19. #19
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Insert Xnumber (X=A1) of rows between data in a table& copy data from a range to new c

    Quote Originally Posted by blue_clouds_mountain View Post
    Thanks for your reply.
    I tried. It's only working for the first entry in column B and inserts only 1 row per clicks. Have I applied it correctly?!
    Is there a way to insert a specified number of rows per click?
    Sorry I've missed that You want to populate it X times.

+ 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. Insert set number of rows between data and copy and paste data above empty rows
    By Orionm45 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2017, 11:35 AM
  2. Copy cells with data - paste (insert rows) to next sheet.
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2016, 01:28 PM
  3. Replies: 13
    Last Post: 07-16-2016, 10:53 PM
  4. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  5. Replies: 2
    Last Post: 04-21-2011, 07:13 PM
  6. Copy paste data, insert rows, insert data and change . to -
    By xWiZardx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2010, 01:44 AM
  7. using a dynamic reference cell to copy a range of cells within a data table
    By mcash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2010, 10:22 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