Prompt for name when copying sheet

  • Thread starter Thread starter Madvark
  • Start date Start date
M

Madvark

I have created a simple macro that copies an existing sheet in a
workbook. Is there anyway to generate a user prompt to name the newly
created sheet? Your time and effort is much appreciated by a
relatively new user. Thanks.
 
Try this Madvark

Sub test()
Dim ShName As String
ShName = InputBox("Fill in a Sheet name")
If Trim(ShName) <> "" Then
Application.ScreenUpdating = False
On Error Resume Next
ActiveSheet.Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = ShName
On Error GoTo 0
Application.ScreenUpdating = True
End If
End Sub
 

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