Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Message "user defined type not defined" LEELK01 Excel Discussion (Misc queries) 2 August 14th 09 07:31 AM
How to copy variable data from 2 worksheets into a seperate 3rdworksheet [email protected] Excel Worksheet Functions 12 February 13th 08 02:02 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
User Defined Type Structure - want it to be variable not numeric literal WyoCracker Excel Programming 1 July 21st 03 09:28 PM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"