+ Reply to Thread
Results 1 to 6 of 6

Pasting Data using LastRow Range

  1. #1
    Registered User
    Join Date
    03-28-2016
    Location
    Indiana
    MS-Off Ver
    2013
    Posts
    5

    Pasting Data using LastRow Range

    Hi,

    I'm currently having trouble copying and pasting a selection of data. Copy range (H16:H18), Paste into another sheet (B:B & LastRow). It will only paste 3 rows of data, and it is not pasting it to the end of the "LastRow". My code is below:

    'Find Last Row
    Dim LastRow As Long
    With Worksheets("2. BA&R Customer Product Tab")
    LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
    End With

    'Copy Multiple BA&R Entities
    Worksheets("Multiple BA&R Dimension").Activate
    Worksheets("Multiple BA&R Dimension").Range("H16:H18").Select
    Selection.Copy

    'Paste Multiple BA&R Entities
    Worksheets("2. BA&R Customer Product Tab").Activate
    Worksheets("2. BA&R Customer Product Tab").Range("B10:B" & LastRow).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Thanks,
    Dan

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Pasting Data using LastRow Range

    To clarify, you want to paste into the next unused row, correct?

    EDIT: A moderator is likely to insist that you use the [CODE] tags to encapsulate your code. Please preemptively make that correction.
    Last edited by CAntosh; 03-29-2016 at 01:37 PM.

  3. #3
    Registered User
    Join Date
    03-28-2016
    Location
    Indiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Pasting Data using LastRow Range

    I want it to paste into the selection B10 to B Last Row. In that column, there will be blank rows along with not blank rows.

    So in this case it should be pasting from B10 to B30, but it is stopping at B10 to B12.

    Thanks,
    Dan

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Pasting Data using LastRow Range

    You're only copying three cells, so what are looking to paste from B13 to B30?

    Can you post a sample workbook (Use: Go Advanced > Manage Attachments) with fake or non-private data so we can see what you're working with?

  5. #5
    Registered User
    Join Date
    03-28-2016
    Location
    Indiana
    MS-Off Ver
    2013
    Posts
    5

    Re: Pasting Data using LastRow Range

    I'd be looking to copy those three cells over and over again until it reached the last row.

    So like this:
    a
    b
    c
    a
    b
    c
    etc.

  6. #6
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Pasting Data using LastRow Range

    Your procedure needs a loop, but I'm still not clear on what your spreadsheet looks like. Is it pasting over data in B10:B30? Your procedure uses column B to identify the last row, so if it was supposed to find row 30 to be the last row, that would mean there was already data down through B30 that your procedure is meant to paste over. That doesn't sound like what you're aiming for. Can you post a sample workbook or try to paint a better picture of the 'before' and intended 'after'?

+ 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. R1C1 lastRow not lastRow when data combined
    By Spyderwoman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2016, 05:20 PM
  2. [SOLVED] Using range with lastrow
    By luizmachado in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2016, 06:04 PM
  3. [SOLVED] LastRow - for next loops longer than lastrow?
    By flabb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2016, 12:39 PM
  4. [SOLVED] BorderAround for Range (lastRow)
    By Quasis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2015, 03:01 PM
  5. [SOLVED] Changing range in VBA to lastrow
    By BlakeSkate in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-07-2015, 05:01 PM
  6. How to transpose data into range ("A1:G" & lastrow)
    By jasondu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2012, 10:39 AM
  7. Copy from named range down until lastrow?
    By jazbath in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-19-2007, 05:56 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