I am trying to build a vb macro in excel 2007 that will allow me to copy the 4th sheet in my workbook and then create a new sheet from that copy with today's date as the label. I am still learning VB so I am not quite sure how to do this. Help please.
How to copy sheet in workbook to another copy of it?
Collapse
X
-
-
This is the macro for Excel 2003.
Maybe You have to adapt it to 2007 !
Code:Sub Macro1() Dim SHEETidx As Integer For SHEETidx = 1 To Sheets.Count If Sheets(SHEETidx).Name = CStr(Replace(Date, "/", "-")) Then MsgBox "the sheet with this date exist!" Exit Sub End If Next Sheets("Sheet4").Select Sheets("Sheet4").Copy After:=Sheets(Sheets.Count) Sheets(Sheets.Count).Name = CStr(Replace(Date, "/", "-")) End Sub -
Comment