• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy Data from One sheet to Other sheet

Hi all,

I need to copy data from sheet VVV to Paste in Sheet UUU.
The last column in sheet UUU should refer "B" bcz only "B" column will have full data without any blank.
i have worked on this code but iam getting error mentioned in BOLD, enclosed sample file for your reference.


Code:
Option Explicit

Sub con_us_can()
Dim lr1 As Long
Dim y As Workbook

    With y.Sheets("UUU")
    lr1 = .Range("B" & .Rows.Count).End(xlUp).Row
    
    Sheet2.Activate
    Sheets("VVV").Range("A1:P1").Copy Sheets("UUU").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
End Sub

thanks
Jawahar
 

Attachments

rollis13

Member
This would work too.
Code:
Option Explicit
Sub con_us_can()
    Sheets("VVV").Range("A1:P" & Range("B" & Rows.Count).End(xlUp).Row).Copy Sheets("UUU").Range("B" & Rows.Count).End(xlUp).Offset(1)
End Sub
 
Hi,
Thanks for your Time.
At the mean time i to worked on this code its is also working fine.

>>> use code - tags <<<
Code:
DestLastRow = wsDest.Cells(wsDest.Rows.Count, "B").End(xlUp).Offset(1).Row
wsCopy.Range("A2:Q" & CopyLastRow).Copy _
wsDest.Range("A" & DestLastRow)
 
Last edited by a moderator:

rollis13

Member
Yeh, it's exactly the same, just change reference to range "A2:Q" but on two (and more other) lines of code.
 
Top