![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi all,
I am doing an A-level piece of coursework in excel and am stuck. I have a button that copies a worksheet, adds a new worksheet, and then into that newly added worksheet it pastes the previously copied data.... So it basically makes a replica of the original sheet. This is all ok, but i want it to rename the created sheets accordingly... So that the first copy made is renamed 'standard window 1', then the next time the button is pressed i want it to rename the sheet 'standard window 2'..etc I dont think this is particularly hard but i havent figuyred it out yet and am getting a bit panicky, the dealine is ever advancing!!! Please can some one tell me how, i dont mind a bit of VB as i assume this is the only way.. Thanks in advance. If u would rather email me yer comments my address is mhouldey@yahoo.co.uk Cheers, Mike Houldey :| If only... |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try using this code for your command button:
Private Sub CommandButton1_Click() Dim counter As Integer counter = Worksheets.Count Sheets("Sheet1").Copy After:=Sheets(counter) Sheets("Sheet1 (2)").Name = "standard window " & counter End Sub Subsitute "Sheet1" with your first worksheet's name. I hope this helps. Kind regards, Al [ This Message was edited by: Al Chara on 2002-03-14 07:37 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|