+ Reply to Thread
Results 1 to 5 of 5

VBA coding: macro to create a new sheet and have it named by data in a cell and the date

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    United States
    MS-Off Ver
    Office 2011
    Posts
    41

    VBA coding: macro to create a new sheet and have it named by data in a cell and the date

    The code I have right now will create a new sheet and insert the date, as the name of the sheet, but I'd like the code to do that and use data from a cell, as the name of the worksheet.

    here's the current code:

    Sub CheckAndAddSheetNameAsCurrentDate()

    Dim SheetName As String

    SheetName = Format(Date, "mm-dd-yy")

    On Error GoTo AddNew
    Sheets(SheetName).Activate
    Exit Sub

    AddNew:
    Sheets.Add , Worksheets(Worksheets.Count)
    ActiveSheet.Name = SheetName

    End Sub


    For bonus points, I'm trying to find out how to add a static date using a macro, that when a new worksheet template is opened it inserts the current date into this cell, and then NEVER changes it. I'm also looking to share a workbook, but lock a worksheet of that workbook. And I need to then create a worksheet of this workbook where all of this data is updated, but on a day by day basis and its clearly stated what day the data is from. (I have more requests, but I'm working this through.)

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: VBA coding: macro to create a new sheet and have it named by data in a cell and the da

    Hello,

    This should help you to name your sheet and add the date to a cell.
    Please Login or Register  to view this content.
    Not sure for your others questions.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    11-21-2012
    Location
    United States
    MS-Off Ver
    Office 2011
    Posts
    41

    Re: VBA coding: macro to create a new sheet and have it named by data in a cell and the da

    It didn't work, it said subscript is out of range...besides, what I'm trying to do is have a button that opens a new worksheet and names that worksheet with the current date and my name, which is specific data in a cell in the worksheet.

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: VBA coding: macro to create a new sheet and have it named by data in a cell and the da

    Without seeing your workbook, difficult to give a good answer.

    You have to adapt the code to your workbook (ie, rename the sheet if required)

    Can you post your workbook?

  5. #5
    Registered User
    Join Date
    11-21-2012
    Location
    United States
    MS-Off Ver
    Office 2011
    Posts
    41

    Re: VBA coding: macro to create a new sheet and have it named by data in a cell and the da

    I got some help in the VBA side of the forum, it works. Thanks though...now I just need to figure out the other bits...

+ 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. Create new sheet named today's date and paste existing data into the sheet
    By kmao2004 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2014, 06:35 PM
  2. Search folders for named worksheets and create a master sheet of merged data
    By pmhancock10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-20-2013, 10:40 AM
  3. Coding help to transfer cell data to different sheet
    By DancingElvis in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-13-2013, 02:09 PM
  4. Replies: 19
    Last Post: 05-13-2013, 01:08 PM
  5. [SOLVED] Need Macro to Create New Worksheet Named After Currently Selected Cell
    By logabr01 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2013, 01:42 PM

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