Hi all,

I'm trying to copy data from Sheet2 in first workbook in to Sheet1 in second workbook.

But i encounter subscript error in my following code.

Code:
Sub CopyData()

Dim WS1 As Worksheet, WS2 As Worksheet

Set WS1 = Workbooks("A").Sheets("Name")
Set WS2 = Workbooks("B").Sheets("Name")



WS1.UsedRange.Copy WS2.Cells.(Rows.Count, "A").end(xlUp)

End Sub
How do i resolve this?
Is there any better ways to achieve this?
Please help and enlighten.