Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy worksheets with a user defined variable
am a novice when it comes to creating Excel templates but I have
managed to do rather well up until now. I am trying to create a pricing template that allows a user to define a number of locations for a multi-location template. I need the workbook to automatically copy a worksheet a set number of times depending on what number the user enters. For example, if the company has 8 locations, the user would enter the number 8 in the box and the workbook would copy the location tab 8 times. Does anyone know how to do that or am I wanting Excel to do something it can't? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy worksheets with a user defined variable
Try this Greg
Sub test() myNum = Application.InputBox("Enter a number", Type:=1) For a = 1 To myNum Worksheets("Pricing").Copy After:=Worksheets(Sheets.Count) ActiveSheet.Name = "Pricing " & a Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Greg K" wrote in message om... am a novice when it comes to creating Excel templates but I have managed to do rather well up until now. I am trying to create a pricing template that allows a user to define a number of locations for a multi-location template. I need the workbook to automatically copy a worksheet a set number of times depending on what number the user enters. For example, if the company has 8 locations, the user would enter the number 8 in the box and the workbook would copy the location tab 8 times. Does anyone know how to do that or am I wanting Excel to do something it can't? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy worksheets with a user defined variable
Thanks a bunch. That did the trick. Now how does one get their boss to understand that they need a raise for this kind of work when they weren't hired for it? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Message "user defined type not defined" | Excel Discussion (Misc queries) | |||
How to copy variable data from 2 worksheets into a seperate 3rdworksheet | Excel Worksheet Functions | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
User Defined Type Structure - want it to be variable not numeric literal | Excel Programming |