Naming a inserted Worksheet

  • Thread starter Thread starter Jerry Eggleston
  • Start date Start date
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
 
add this
dim strdate as string
strdate = Format(Now, "d-mmm")'use format you want
change to this
Sheets("A").name = strdate & " " & "Perdiem"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top