LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copying a formatted "template" sheet and naming new sheet via user form

Hi. I've done some hunting around and reading and came up with the
following code that creates a new blank sheet and names it via a user
form, but I can't work out how to do the same thing if I want to use a
formatted template worksheet. Please help!

Sample code I've come up with so far:

'Create a new blank worksheet
'Name the worksheet by entering the employee name and number
'in the appropriate boxes
'Clicking OK will transfer the name to the worksheet tab
Private Sub cbNewEmpSheetNameFormOK_Click()
Dim NewSheet As Worksheet
On Error Resume Next
Set NewSheet = Worksheets(tbxNewEmpSheetNameFormName.Text & "-" _
& tbxNewEmpSheetNameFormNo.Text)
If Err 0 Or NewSheet Is Nothing Then
Worksheets.Add befo=Worksheets(Worksheets.Count)
ActiveSheet.Name = tbxNewEmpSheetNameFormName.Text & "-" _
& tbxNewEmpSheetNameFormNo.Text
Worksheets(2).Select
'The sheet is checked to ensure that it's not a duplicate of an
already existing sheet
Else
Beep
MsgBox "Sheet already exists!"
End If
Unload Me
End Sub

 
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
Creating a "Next" button to move the user to the next sheet Rob Excel Discussion (Misc queries) 2 March 29th 09 12:14 PM
A "form" for feeding an Excel Sheet? DeeDeeCee Excel Discussion (Misc queries) 4 August 6th 07 07:38 AM
Prevent user from inserting sheet via "CTRL-F11" [email protected] Excel Programming 3 October 9th 06 07:40 PM
Naming cell ranges, copying formulas for a range & nesting "IF" fu DonF Excel Discussion (Misc queries) 3 October 5th 06 05:47 PM
Tab order with "enter" key on a sheet form quartz Excel Programming 3 April 19th 04 08:42 PM


All times are GMT +1. The time now is 09:51 AM.

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

About Us

"It's about Microsoft Excel"