Hi I have a sheet of data ("Sheet1") in my current workbook. I want to add a new workbook, copy the data from "Sheet1" into the new workbook, save the new workbook as "G:\Folder\Workbook1.csv", overwrite any existing file of the same name, and close - all without stopping me to ask for permission.
So basically every week I want to take a bunch of data that I produce, and create/update a workbook with the same name every week. The data from the previous week should be erased prior to the addition of the current data.
I am doing it a really long way that takes much more time than I think is necessary.
Workbooks.Open ("G:\Folder\Workbook1.csv")
For i = 1 To compcount
For j = 1 To 256
Workbooks("CurrentData.xls").Worksheets("Sheet1").Cells(i, j).Copy Destination:=Workbooks("Workbook1.csv").Worksheets(1).Cells(i, j)
Next j
Next i
Workbooks("Workbook1.csv").Save
Workbooks("Workbook1.csv").Close
It's a pretty unsophisticated way of doing it but it works. I'm hoping though someone can teach me a new trick.
Thank you.
So basically every week I want to take a bunch of data that I produce, and create/update a workbook with the same name every week. The data from the previous week should be erased prior to the addition of the current data.
I am doing it a really long way that takes much more time than I think is necessary.
Workbooks.Open ("G:\Folder\Workbook1.csv")
For i = 1 To compcount
For j = 1 To 256
Workbooks("CurrentData.xls").Worksheets("Sheet1").Cells(i, j).Copy Destination:=Workbooks("Workbook1.csv").Worksheets(1).Cells(i, j)
Next j
Next i
Workbooks("Workbook1.csv").Save
Workbooks("Workbook1.csv").Close
It's a pretty unsophisticated way of doing it but it works. I'm hoping though someone can teach me a new trick.
Thank you.