+ Reply to Thread
Results 1 to 3 of 3

create new workbook, copy data, rename sheet.

  1. #1
    Registered User
    Join Date
    09-11-2013
    Location
    zastron,south africa
    MS-Off Ver
    Excel 2010
    Posts
    48

    create new workbook, copy data, rename sheet.

    Hi all
    My aim is to click a commandbutton in a userform with 4 textboxes.
    Then a new workbook must be created, the data must be pasted and the sheet must be named after textbox2. After this the sheet must contain the values of the userform textboxes values, then it must save the workbook and name it from textbox1 or activesheet range for textbox1.

    This is my current code:

    Please Login or Register  to view this content.
    Any help will be appriciated, thanx
    Last edited by arlu1201; 10-10-2013 at 01:01 AM. Reason: Corrected code tags.
    Creating POS

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: create new workbook, copy data, rename sheet.

    Please Login or Register  to view this content.
    you created a new Workbook, now ThisWorkbook is NewBook
    the correct code is
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: create new workbook, copy data, rename sheet.

    Hi, patel45,

    youŽre sure about
    you created a new Workbook, now ThisWorkbook is NewBook
    ThisWorkbook can only be the workbook with code while ActiveWorkbook can be any active workbook (either ThisWorkbook when the code starts or any other workbook).

    @simeonmein
    Please Login or Register  to view this content.
    IŽd guessed to read it like
    Please Login or Register  to view this content.
    vbNullString and "" should be very very similar to each other but if you want to compare values from a textbox you would need to mention this in both parts of the comparision (you canŽt check one textbox for two conditions unless you use Select Case).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] A button to create Sheet2, copy there data from Sheet1 and rename the sheet?
    By mintymike in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2012, 10:34 AM
  2. Replies: 2
    Last Post: 09-04-2012, 01:19 AM
  3. [SOLVED] Code to create new sheet and rename, regardless of any other sheets in workbook
    By csh8428 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2012, 02:22 PM
  4. Replies: 0
    Last Post: 04-28-2012, 06:06 PM
  5. Create copy of sheet & rename
    By Vetequk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2010, 08:40 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1