+ Reply to Thread
Results 1 to 5 of 5

Creating A New Sheet Using VBA

  1. #1
    Registered User
    Join Date
    01-03-2020
    Location
    US
    MS-Off Ver
    2019
    Posts
    85

    Question Creating A New Sheet Using VBA

    Hi friends,
    I want to create a new sheet using VBA. I allocated my code (I learnt it from web) to a button but it fails to run. I tried to create a class module and then the main module, but the error says the function has not been defined.
    The plan is that the code must check the new page name and if it does not exist, creates it, else nothing happens.
    Please guide me.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Creating A New Sheet Using VBA

    This line usually works:

    Sheets.Add 'Create new sheet

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,070

    Re: Creating A New Sheet Using VBA

    The function should be in a normal module, not a class module. However you don't need it.
    You could just use
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Creating A New Sheet Using VBA

    This works, not sure what the if then does:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,070

    Re: Creating A New Sheet Using VBA

    @maniacb
    That just adds a new sheet & names it. It doesn't check if the sheet exists first.

+ 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. Replies: 8
    Last Post: 03-27-2020, 11:39 AM
  2. Macro filtering on main data sheet and creating new sheet with the results
    By will5will in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2018, 11:43 AM
  3. [SOLVED] Creating macro to populate specific cells from master sheet to work sheet
    By tatyanamarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2017, 03:19 AM
  4. Excel VBA - Creating a macro that inserts the active sheet name inside another sheet cell'
    By brandonstockwell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2014, 12:29 AM
  5. Creating a sheet from a previous sheet excluding empty columns
    By a.benzabeh in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-31-2012, 08:55 AM
  6. Replies: 6
    Last Post: 07-25-2012, 07:55 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