Hi,
Please tell me there is an Excel Rockstar out there that can help with a macro that's giving me trouble!
I was hoping for the following code to:
- open a specific csv file (called RAW.csv)
- copy data from that same .csv file
- open an xls template (that includes formulas on sheet 1 and a pivot on sheet 2)
- paste the data from the csv file to the xls template on sheet 1 (called data)
- and go to sheet 2 on the xls template (called pivot) and refresh the pivot
The code I'm using opens both files but there is a "Run time error 9" before the task is complete, please advise.
Sub MACROattempt4()
'
'
Workbooks.Open Filename:= _
"Q:\Reports\Daily \OUT DATA\RAW.csv"
Range("A1:R2000").Select
Selection.Copy
Workbooks.Open Filename:= _
"Q:\Reports\Daily \IN DATA\BLANK.xlsm"
Windows("BLANK.xlsm").Activate
Sheets("data").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Pivot").Select
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
Workbooks("RAW.csv").Close
Workbooks("BLANK.xlsm").Close
End Sub
Any advise is greatly appreciated!
DATAN4113
Bookmarks