+ Reply to Thread
Results 1 to 3 of 3

Copy and pasting a dynamic range from one sheet to another

  1. #1
    Registered User
    Join Date
    01-22-2014
    Location
    Huddersfield
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copy and pasting a dynamic range from one sheet to another

    Hi

    I'm trying to copy a range of column headers from one worksheet and paste them in another using a macro
    The source range starts at Q1 and runs along row 1 for a variable number of columns each time.
    The destination cells start at B1 and will run along row 1 for the same number of columns.

    I've got as far as counting the number of source columns

    PHP Code: 
    Dim LastDate As Long

    LastDate 
    Sheets("Edited data").cells(1Columns.Count).End(xlToLeft).Column 
    But I'm not sure how to paste to a changing number of columns

    PHP Code: 
     Sheets("Edited data").Range("Q1"cells(1LastDate)).copy Destination:=Sheets("Variety Total").Range("B1", ????) 
    Any help would be appreciated. My VBA knowledge is basic so the simpler the better

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy and pasting a dynamic range from one sheet to another

    Try:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Copy and pasting a dynamic range from one sheet to another

    Please Login or Register  to view this content.

+ 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 Formulas from Set of Columns and Pasting into a Dynamic Range
    By Mr. Ice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2014, 08:07 AM
  2. Copy and Pasting dynamic data into blank rows and of another sheet
    By Lisa4legin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-18-2013, 07:49 PM
  3. [SOLVED] Macro: Dynamic creation of sheet based on cell value then copy range to the new sheet
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-15-2012, 11:31 AM
  4. Copy dynamic range from previous sheet and paste after last used row in a range
    By Mistweaver in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-04-2010, 06:24 PM
  5. copy dynamic range to another sheet
    By barkarlo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2009, 01:08 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