Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
ahmed
 
Posts: n/a
Default 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   Report Post  
JE McGimpsey
 
Posts: n/a
Default

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 ,
"ahmed" 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i create an access code sheet to number my office files an. dana New Users to Excel 1 February 12th 05 04:49 AM
Find all text instances in a sheet and add one number from each row Greg Excel Discussion (Misc queries) 1 February 1st 05 12:45 AM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 06:59 PM
Use Julian Date To Create Serial Number antho10359 Excel Discussion (Misc queries) 4 December 9th 04 02:50 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 08:16 PM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"