ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prompt for tab name and then prompt for number of iterations of ta (https://www.excelbanter.com/excel-programming/432926-prompt-tab-name-then-prompt-number-iterations-ta.html)

bert_lady

Prompt for tab name and then prompt for number of iterations of ta
 
Need code to prompt users for the name of the sheet to copy and then prompt
for the number of copies of the sheet they want. I have dinked around with
this for a while and am really missing something

Thanks
--
bert_lady

Matthew Herbert[_3_]

Prompt for tab name and then prompt for number of iterations of ta
 
bert_lady,

Utilize the help documentation. Search "InputBox" and read the
documentation on Application.InputBox Method and InputBox Function. Also,
search "Worksheets.Add" and read the documentation for Worksheets.Add Method.
After you prompt the user for the worksheet name, you should validate that
the worksheet exists before prompting for the number of copies.

Start with the help documentation. If you are still having trouble, post
your code to the thread with any subsequent questions.

Best,

Matthew Herbert

"bert_lady" wrote:

Need code to prompt users for the name of the sheet to copy and then prompt
for the number of copies of the sheet they want. I have dinked around with
this for a while and am really missing something

Thanks
--
bert_lady


Gord Dibben

Prompt for tab name and then prompt for number of iterations of ta
 
Sub SheetCopy22()
Dim I As Long
Dim shts As Long
Dim whichone As String
On Error GoTo endit
Application.ScreenUpdating = False
whichone = InputBox("enter sheet name to copy")
shts = InputBox("How many times?")
For I = 1 To shts
Sheets(whichone).Copy After:=ActiveSheet
' With ActiveSheet
' .Name = "NewSheet" & I
' End With
Next I
Application.ScreenUpdating = True
endit:
End Sub


Gord Dibben MS Excel MVP

On Thu, 27 Aug 2009 08:34:10 -0700, bert_lady
wrote:

Need code to prompt users for the name of the sheet to copy and then prompt
for the number of copies of the sheet they want. I have dinked around with
this for a while and am really missing something

Thanks




All times are GMT +1. The time now is 04:35 PM.

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