+ Reply to Thread
Results 1 to 2 of 2

automatic new serial number for each new sheet within one file

  1. #1
    ahmed
    Guest

    automatic new serial number for each new sheet within one file

    i want to creat an automatic serial nos. when i`m creating an new sheet
    inside the current workbook;
    Example : inside sheet no.(1) appears a serial noumber (001)
    and by creating a new sheet in the same workbook appears in the sheet no. (2)
    the serial no. (002).... etc.

    Thank You very much

  2. #2
    JE McGimpsey
    Guest

    Re: automatic new serial number for each new sheet within one file

    One way:

    Put this in your ThisWorkbook code module (if you're unfamiliar with
    macros, see

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    for help).

    Private Sub Workbook_NewSheet(ByVal Sh As Object)
    Dim ws As Worksheet
    Dim nSerialNumber As Long
    If TypeName(Sh) = "Worksheet" Then
    For Each ws In Worksheets
    With ws.Range("A1")
    If .Value > nSerialNumber Then nSerialNumber = .Value
    End With
    Next ws
    With Sh.Range("A1")
    .Value = nSerialNumber + 1
    .NumberFormat = "000"
    End With
    End If
    End Sub


    In article <38717281-55FA-4551-BE50-281AA8F2E7C9@microsoft.com>,
    "ahmed" <ahmed@discussions.microsoft.com> wrote:

    > i want to creat an automatic serial nos. when i`m creating an new sheet
    > inside the current workbook;
    > Example : inside sheet no.(1) appears a serial noumber (001)
    > and by creating a new sheet in the same workbook appears in the sheet no. (2)
    > the serial no. (002).... etc.
    >
    > Thank You very much


+ 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