+ Reply to Thread
Results 1 to 9 of 9

if sheet2 not exits then creat one

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    if sheet2 not exits then creat one

    Please Login or Register  to view this content.
    plse correct the above vba

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: if sheet2 not exits then creat one

    THis is VBA, I will move it to thatr forum for you
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: if sheet2 not exits then creat one

    Try this:

    Please Login or Register  to view this content.
    Regards,
    tt3

  4. #4
    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: if sheet2 not exits then creat one

    Hi, asdzxc,

    3 ways fo doing so: error handler, loop through all sheets, use a function to determine whether a worksheet exists.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    [ Edit ]
    Forgot about Evaluate as most of the time:
    Please Login or Register  to view this content.
    [ /Edit ]

    Ciao,
    Holger
    Last edited by HaHoBe; 09-22-2013 at 02:57 AM. Reason: added one more way, corrected aerror in colde-line
    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

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: if sheet2 not exits then creat one

    I like this: easy & short

    Please Login or Register  to view this content.

  6. #6
    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: if sheet2 not exits then creat one

    Hi, tuongtu3,

    I donīt because I realized that there was one character missing in the sample. Code should look like
    Please Login or Register  to view this content.
    Code posted earlier would create new sheets but be unable to rename them accordingly.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: if sheet2 not exits then creat one

    sloved thank you

  8. #8
    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: if sheet2 not exits then creat one

    Hi, asdzxc,

    could you please mark the Thread as Solved via Thread Tools over the first post?

    Ciao,
    Holger

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: if sheet2 not exits then creat one

    Thanks Holger.

    asdzxc,

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. VBA bug - code exits sub before completion - no error message
    By stefsj in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-28-2010, 01:26 PM
  2. Reprotect after macro exits.
    By D1TrueGod in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2008, 12:34 AM
  3. Excel exits without prompts when tabbing. Please HELP!
    By pavlouc in forum Excel General
    Replies: 0
    Last Post: 07-31-2007, 11:27 AM
  4. [SOLVED] Sub Exits Unexpectedly
    By Walker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2005, 06:06 PM
  5. way to run sub after user exits textbox
    By funkymonkUK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2005, 09:06 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