+ Reply to Thread
Results 1 to 2 of 2

Copy and paste a range based on a cell value.

  1. #1
    Registered User
    Join Date
    08-04-2022
    Location
    uk
    MS-Off Ver
    office 2016
    Posts
    1

    Copy and paste a range based on a cell value.

    I have a range of data in cells k2:m2
    I want to paste it into cells f7:h7
    But If cell d1 =1 I want to copy and insert the range once.
    If D1=2 I want to insert the range twice so it would occupy F7:h7 and F8:h8 and so on.
    I need this to continue to whatever the D1 cell value equals.
    I need to write this as macro so a command button will recognise D1 and copy the range and paste the range "x" times always starting at F7:h7.
    I would be grateful for any assistence on this please

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

    Cool Try this !


    A VBA demonstration as a beginner starter :

    PHP Code: 
    Sub Demo1()
        [
    K2:M2].Copy [F7].Resize([D1])
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

+ 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] VBA to copy a formula from a cell range and paste it to a cell range based on date
    By dedark05 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2019, 04:41 AM
  2. Copy a cell range and paste it to a cell based on date
    By dedark05 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2019, 08:41 PM
  3. [SOLVED] VB Code to copy and paste range to certain sheet based on cell Value
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2019, 03:38 PM
  4. Copy and Paste a range based on a cell value that is not static
    By JmundleBofA in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-10-2014, 03:25 PM
  5. Macro to copy and paste range based on cell value
    By msls09 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-05-2013, 12:57 AM
  6. VBA code to copy and paste range based on separate cell value
    By Mhofu in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-01-2012, 03:03 PM
  7. Finding a named range based on cell value and copy/paste to same sheet?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2006, 06:25 PM

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