adding a sheet and renaming

  • Thread starter Thread starter oercim
  • Start date Start date
O

oercim

Hello. With excel macro, I want to add a sheet and rename the
sheet but the name is not specific, it is a variable. For example,

Sub b()
Sheets.Add.Name = "aaaa"
End Sub

works fine but here , the sheet name is not variable, it is
specific named "aaaa",
However, the below gives error

Sub b()
Dim a As String
a = "aaaa"
Sheets.Add.Name = a
End Sub

What can I do? Thanks alot.
 
Works fine for me. It will fail if that sheet already exists.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 

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

Similar Threads


Back
Top