ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prompt for name when copying sheet (https://www.excelbanter.com/excel-programming/301088-prompt-name-when-copying-sheet.html)

Madvark

Prompt for name when copying sheet
 
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.

Ron de Bruin

Prompt for name when copying sheet
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Madvark" wrote in message om...
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.





All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com