PDA

View Full Version : Copy to new workbook the active sheets and erase the content of the original



civilwar
01-22-2010, 10:54 AM
How to make a vba procedure that will copy the entire content of Sheets1 to a new workbook and save it with the current date and erase the content of the original for the use to the next day.

Bob Phillips
01-22-2010, 11:41 AM
This should get you started



Dim sh As Worksheet

Set sh = ActiveSheet
sh.Copy
activeworkook.SaveAs Filename:=Format(Date, "yyyymmdd")
sh.Parent.Activate
sh.Activate
sh.UsedRange.ClearContents

civilwar
01-26-2010, 03:04 AM
This should get you started



Dim sh As Worksheet

Set sh = ActiveSheet
sh.Copy
activeworkook.SaveAs Filename:=Format(Date, "yyyymmdd")
sh.Parent.Activate
sh.Activate
sh.UsedRange.ClearContents


Thanks a lot.
Another question, how to clear the contents of only used range and delete it, like from A4 up to the last row used but the formula and formatting must be left in row A4 up to O4?