Hello,
I would like to find out how to autofill a column in another workbook.
Here is my code so far:
The macro gives me a Run Time error '1004' Method 'Range' of Object'_Global' failed.
Can someone please help to explain what i am missing in my code?
Thank you.
I would like to find out how to autofill a column in another workbook.
Here is my code so far:
VBA Code:
Sub Task1 ()
Set wb4 = Workbooks("Task1")
Set ws4 = wb4.Sheets("Sheet1")
'code lines for copy and paste from Workbook "A" to Workbook "Task1"
LstRow = ws4.Range("A" & Rows.Count).End(xlUp).Row
ws4.Range("N3").Formula = "=L3-M3"
ws4.Range("O3").Formula = "=N3*G3"
ws4.Range("N3:O3").AutoFill Destination:=Range("N3:O" & Lstrow)
End Sub
The macro gives me a Run Time error '1004' Method 'Range' of Object'_Global' failed.
Can someone please help to explain what i am missing in my code?
Thank you.