Hi,
I'm very close to being able to insert a copy of one worksheet at the end of my workbook, and rename the new sheet using current date and time. Date is easy, it's time that's giving me a little hassle - presumably since Excel doesn't like you using : in your sheetname. Here's my code:
Dim curdate As String
curdate = Format(Date, "mm-dd-yy hh:mm:ss")
Sheets("Summary").Select
ActiveSheet.Cells.Select
Selection.Copy
Dim nLast As Long
Dim i As Long
With ActiveWorkbook
nLast = .Sheets.Count
For i = 1 To ActiveWindow.SelectedSheets.Count
.Sheets.Add _
After:=.Sheets(.Sheets.Count), _
Type:="worksheet", _
Count:=1
Next i
.Sheets(nLast + 1).Select
ActiveCell.Cells.Select
ActiveSheet.Paste
ActiveSheet.Name = curdate
End With
Only the activesheet.name = curdate is giving me hassles. Any recommendations how to scrub the colons before this line?
Thanks!
Barrett
I'm very close to being able to insert a copy of one worksheet at the end of my workbook, and rename the new sheet using current date and time. Date is easy, it's time that's giving me a little hassle - presumably since Excel doesn't like you using : in your sheetname. Here's my code:
Dim curdate As String
curdate = Format(Date, "mm-dd-yy hh:mm:ss")
Sheets("Summary").Select
ActiveSheet.Cells.Select
Selection.Copy
Dim nLast As Long
Dim i As Long
With ActiveWorkbook
nLast = .Sheets.Count
For i = 1 To ActiveWindow.SelectedSheets.Count
.Sheets.Add _
After:=.Sheets(.Sheets.Count), _
Type:="worksheet", _
Count:=1
Next i
.Sheets(nLast + 1).Select
ActiveCell.Cells.Select
ActiveSheet.Paste
ActiveSheet.Name = curdate
End With
Only the activesheet.name = curdate is giving me hassles. Any recommendations how to scrub the colons before this line?
Thanks!
Barrett