+ Reply to Thread
Results 1 to 6 of 6

macros to auto name sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    3

    macros to auto name sheets

    I've tried many times to create a workbook that auto names the sheets by day for a month. I've never done macros before but feel I'm pretty computer literate. The internet if full of code for this but I'm unable to get it to work. Can anyone walk me through step-by-step? I must be missing something!

  2. #2
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: macros to auto name sheets

    Hi!

    What exactly do you want? Should the macro create worksheets out of thin air and name them or are there already worksheets you want to name? Where should the macro get the date from? Is it already placed somewhere on the worksheet?

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: macros to auto name sheets

    It would be great to create from a date range(ex. Jan. 1-31) but I could create. The date will be in "A1" but will be auto populated from a summary/totals sheet.
    Thanks,

  4. #4
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: macros to auto name sheets

    How about something like this?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: macros to auto name sheets

    That worked great. I've been trying to get this macros but just can't get my head around it. I now need to populate the "A1" cell of each sheet with my range of dates or populate "A1" by sheet name.
    Thanks again

  6. #6
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: macros to auto name sheets

    It can be done by adding one line. Replace the code in the module to this:
    Sub AddSheets()
    
    Dim i As Long
    Dim Lr As Long
    Dim MySh As Worksheet
    
    Set MySh = ActiveSheet
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    
    For i = 2 To Lr
        Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = MySh.Range("A" & i).Text
        Range("A1").Value = MySh.Range("A" & i).Value
    Next i
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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