View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Donald Guillett Donald Guillett is offline
external usenet poster
 
Posts: 36
Default Help copying last sheet and renaming to next consecutive number

On Apr 21, 1:35*pm, ajgillikin wrote:
I have a daily report I am putting together, and need help with the
VBA coding for a macro. *I have RPT 1 as the first sheet, and would
like to copy it, paste it at the end, rename it RPT 2, then move some
data, rename a few cells, clear some data. *I have the last part
pretty much figured out. *My problem is setting the macro to copy the
last sheet in the book, then rename it to RPT n (or previous report
+1). *I have some cobbled together code, but would rather not post it,
and I've searched through the posts, but nothing fits what I am
looking for. *BTW, this is my first run with macros and programming.
Thanks for the help.


Perhaps this will help. ALLWAYS post your code for comments

Option Explicit
Sub CopyLastSheetAndName()
Dim ls As Long
ls = ActiveWorkbook.Sheets.Count
'MsgBox ls
Sheets(Sheets.Count).Copy after:=Sheets(ls)
ActiveSheet.Name = "Rpt " & ls + 1
End Sub