Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: A simple problem.... probably...

  1. #1
    Guest

    Default

    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. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •