Naming a inserted Worksheet

J

Jerry Eggleston

I have a macro that inserts a new worksheet based on a template. I a
having problems naming this worksheet however. Here is the code:

Sheets("Cover Sheet").Select
Sheets.Add Type:= _
"C:\Documents\per diem sheet.xlt"
Sheets("A").Select
Sheets("A").Name = "Perdiem"



This works great until I try and run the macro more than once. What
would like to do is base the name on the previous worksheet name. fo
example: If the worksheet right before the inserted one is named
Aug, then I would like the new worksheet to be named 1 Aug perdiem.
Again this name would need to change based on the previous workshee
name.



Again thanks in advanced for anyones help.




Jerr
 
F

Frank stone

add this
dim strdate as string
strdate = Format(Now, "d-mmm")'use format you want
change to this
Sheets("A").name = strdate & " " & "Perdiem"
 
Top