Copy and Paste or Equal Value
Results 1 to 3 of 3

Thread: Copy and Paste or Equal Value

  1. #1
    Board Regular
    Join Date
    Nov 2015
    Posts
    397
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Copy and Paste or Equal Value

    Hi can anyone help?

    I am copying data from "AJ2:AS & lRowAJ" to "N2:W & lRowAJ" and "X2:AG & lRowAJ"

    If I use the following line it copies fine

    [CODE
    .Range("AJ2:AS" & lRowAJ).Copy
    .Range("N2:W" & lRowAJ, "X2:AG" & lRowAJ).PasteSpecial Paste:=xlPasteValues][/CODE]

    I would prefer to use the following line but I get errors in "X2:AG" is there something I can add to this line to have it equal the values in "AJ:AS"

    [CODE
    .Range("N2:W" & lRowAJ, "X2:AG" & lRowAJ) = .Range("AJ2:AS" & lRowAJ).Value][/CODE]

    ie

    N O P Q R S T U V W X Y Z AA AB AC AD AE AF AG AH AI AJ AK AL AM AN AO AP AQ AR AS
    1 Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt Nxt
    2 10 1 2 3 4 5 6 7 1 #N/A ### ### ### ### ### ### ### #N/A #N/A 10 1 2 3 4 5 6 7 1
    3
    4
    5
    6
    7
    8
    9
    10


    Regards

    pwill
    Last edited by pwill; Aug 9th, 2018 at 03:16 PM.

  2. #2
    Board Regular
    Join Date
    Nov 2016
    Posts
    585
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Copy and Paste or Equal Value

    dont know about the 1 liner but this is still better than copy/paste

    Code:
    .Range("N2:W" & lRowAJ).Value2 = .Range("AJ2:AS" & lRowAJ).Value2
    .Range("X2:AG" & lRowAJ).Value2 = .Range("AJ2:AS" & lRowAJ).Value2

  3. #3
    Board Regular
    Join Date
    Nov 2015
    Posts
    397
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Copy and Paste or Equal Value

    Thanks JumboCactuar,

    I just had the same idea myself lol works just the same, maybe someone else will come up with a one linner out of interest?

    Thanks away much appreciated

    pwill

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •