+ Reply to Thread
Results 1 to 4 of 4

Numbering Multiple Sheets

  1. #1
    derek
    Guest

    Numbering Multiple Sheets

    I have multiple sheets in a workbook and I would like to have them
    consecutivly numbered. Each sheet is one page, and the only way i can think
    of numbering the pages is manually entering a page number in each sheet. I
    know there has to be a way to have it done automatically. For instance, I
    have 36 sheets with one page each. What I would like is for the first sheet
    to start with a page number of 38, and from each sheet on, 39, 40, 41... Any
    body know how to do this?

    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    maybe this could help
    http://office.microsoft.com/en-gb/as...180461033.aspx

  3. #3
    JLatham
    Guest

    RE: Numbering Multiple Sheets

    I don't know of any way of setting Excel to consistently force starting new
    sheets at a specific number.

    But it can be done in code - this code will do it for you. Currently set up
    so that the next sheet added will be numbered starting at 38. However, it
    looks at the currently numbered sheets and will either start with the next
    highest number, or 38 if there aren't any numbered that high yet.

    Sub AddNamedSheets()
    Dim MaximumNumberInUse As Integer
    Dim LC As Integer ' Loop Counter
    Dim AnySheet As Worksheet
    Dim AnySheetName As String
    Dim AnyNumber As String
    'determine maximum number in use on sheets now
    '
    MaximumNumberInUse = 37 ' initialize to one below where we want to start
    at
    'look at all existing sheets to see where you are
    For Each AnySheet In Worksheets
    AnyNumber = ""
    AnySheetName = AnySheet.Name
    For LC = Len(AnySheetName) To 1 Step -1
    If Mid$(AnySheetName, LC, 1) >= "0" And Mid$(AnySheetName, LC,
    1) <= "9" Then
    AnyNumber = Mid$(AnySheetName, LC, 1) & AnyNumber
    Else ' encountered non-numeric character
    Exit For ' end search
    End If
    Next
    If AnyNumber = "" Then
    AnyNumber = "0"
    End If
    If Val(AnyNumber) > MaximumNumberInUse Then
    MaximumNumberInUse = Val(AnyNumber)
    End If
    Next
    Sheets.Add
    ActiveSheet.Name = "Sheet" & Trim$(Str$(MaximumNumberInUse + 1))
    Range("A1").Select
    End Sub



    "derek" wrote:

    > I have multiple sheets in a workbook and I would like to have them
    > consecutivly numbered. Each sheet is one page, and the only way i can think
    > of numbering the pages is manually entering a page number in each sheet. I
    > know there has to be a way to have it done automatically. For instance, I
    > have 36 sheets with one page each. What I would like is for the first sheet
    > to start with a page number of 38, and from each sheet on, 39, 40, 41... Any
    > body know how to do this?
    >
    > Thanks


  4. #4
    JLatham
    Guest

    RE: Numbering Multiple Sheets

    Look's like davesexcel interpreted your needs better than I did. I was
    thinking you wanted new sheets that were added to the workbook to be numbered
    starting as "Sheet38" etc, rather than just needing the printout/displayed
    worksheets to be uniquely numbered.

    davesexcel has the answer for you. I've got left over code for another day
    to use somewhere ... Next time I'll try to understand the problem just a
    little better.

    "derek" wrote:

    > I have multiple sheets in a workbook and I would like to have them
    > consecutivly numbered. Each sheet is one page, and the only way i can think
    > of numbering the pages is manually entering a page number in each sheet. I
    > know there has to be a way to have it done automatically. For instance, I
    > have 36 sheets with one page each. What I would like is for the first sheet
    > to start with a page number of 38, and from each sheet on, 39, 40, 41... Any
    > body know how to do this?
    >
    > Thanks


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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