Hi everyone,
As described in the title i am using this code (PFB) to paste data from a table in a sheet to a table in another sheet but get this error " run-time error 1004 paste special method of range class failed".
Disclaimer: I have not written code before and I am totally new to this process.
Thank you for looking into this
CODE:
>>> use code - tags <<<
As described in the title i am using this code (PFB) to paste data from a table in a sheet to a table in another sheet but get this error " run-time error 1004 paste special method of range class failed".
Disclaimer: I have not written code before and I am totally new to this process.
Thank you for looking into this
CODE:
>>> use code - tags <<<
Code:
Private Sub CommandButton1_Click()
Dim WS As Worksheet
Dim LR As Long
Dim WS1 As Worksheet
Dim LR1 As Long
Set WS1 = Worksheets("Heme Tracker Output")
Set WS = Worksheets("Heme Tracker Input")
LR = WS.ListObjects("Query3").Range.Rows.Count
LR1 = WS1.ListObjects("Table7").Range.Rows.Count
WS1.Range(WS1.Range("A2"), WS1.Range("A" & LR1)).Clear
WS.Range(WS.Range("A2"), WS.Range("A" & LR)).Copy
WS1.Range("A2").PasteSpecial xlPasteValues ( line where error occurs )
WS1.Range(WS1.Range("B2"), WS1.Range("B" & LR1)).Clear
WS.Range(WS.Range("B2"), WS.Range("B" & LR)).Copy
WS1.Range("B2").PasteSpecial xlPasteValues
Last edited by a moderator: