Prompt for name when copying sheet

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.
 
R

Ron de Bruin

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
 
Top