+ Reply to Thread
Results 1 to 6 of 6

Copy and past row range based on value in another cell

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Copy and past row range based on value in another cell

    Trying to find a VBA code that will copy a row range (A6:T6) and paste below a number of occurrences specified in cell N1. Attached is a copy of the spreadsheet of what I am working on.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by mariannehislop; 03-26-2021 at 07:40 AM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool


    According to your explanation that just needs this single codeline : [A6:T6].Copy [A7].Resize([N1].Value2)

  3. #3
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Copy and past row range based on value in another cell

    Thank you Marc. Brilliant. Well, that was simpler than I thought.

    Thanks again

  4. #4
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Copy and past row range based on value in another cell

    This worked brilliantly when I tried it last night, however today I am getting a compile error: Invalid outside procedure and it highlights the [N1]?

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    Thanks for the rep' !

    According to your message error it seems you paste the codeline outside of a VBA procedure as it must be between Sub … End Sub codelines.

  6. #6
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Copy and past row range based on value in another cell

    Thanks Marc. Yes I sorted it out. I don't know how it actually worked previously????

+ 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 past only values based on cell selection range
    By besis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-06-2019, 11:05 AM
  2. [SOLVED] Copy and past row to another sheet based on date range.
    By christopherlfrancis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2018, 10:03 AM
  3. copy/past rows based on a value in a new worksheet
    By Wacky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2013, 10:37 AM
  4. [SOLVED] select & copy some range and past it to another sheet with sum
    By pedjvak in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-01-2012, 12:24 AM
  5. Replies: 2
    Last Post: 05-30-2012, 05:02 PM
  6. Linking data based on a cell value and copy/past to another worksheet??
    By Tweech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2012, 01:12 PM
  7. Copy last formula in column and past into range
    By mtbe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2009, 09:00 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