How to automatically add a worksheet using macro?

  • Thread starter Thread starter eva
  • Start date Start date
E

eva

Can I add adding a worksheet in a macro? How do I do that?
Ex. I create a new macro. One of the steps in my macro is to insert a new
worksheet.
 
Dim NewWks as worksheet
set NewWks = worksheets.add
with newwks
.name = "Your New Name Here"
.range("A1").value = "Hi there"
End with
 
Thank you

Dave Peterson said:
Dim NewWks as worksheet
set NewWks = worksheets.add
with newwks
.name = "Your New Name Here"
.range("A1").value = "Hi there"
End with
 

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