I am brand new to the VBA world, and am using a macro I found on another website. I have been able to modify it so far to run, but it is erroring when it gets to the red text in the code. Any idea what is wrong with the code below? I basically want it to copy cells A2 through the end of the sheet on wbExported (this should include blank cells so I can use this to delete rows on wbAllData), and paste it starting in cell A2 on wbAllData on Sheet4. wbAllData is an existing workbook, so it does have to specifically paste into Sheet4.
Code:
Set wbExported = MyExcel.Workbooks.Open(strPathFile)
Set wbAllData = MyExcel.Workbooks.Open("Q:/PX_Overview.xlsm")
[COLOR=red]With wbExported.Sheet1.UsedRange[/COLOR]
[COLOR=red]Set rngUsed = .Offset(1, 0)[/COLOR]
[COLOR=red]End With[/COLOR]
[COLOR=red]With wbAllData.Sheet4[/COLOR]
[COLOR=red]rngUsed.Copy _[/COLOR]
[COLOR=red] Destination:=.Cells(2, 1)[/COLOR]
[COLOR=red]End With[/COLOR]