View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Zairn[_4_] Zairn[_4_] is offline
external usenet poster
 
Posts: 1
Default autonumbering in excel..

i managed to sort a coding out. as follows:

Private Sub Workbook_Open()

Dim LOldVal As Integer
Dim LNewVal As String

'Retrieve current number
LOldVal = Sheets("Sheet1").Range("A2").Value
LNewVal = Format(LOldVal + 1, "0000")

'Update to new number
Sheets("Sheet1").Range("A2").Value = "'" & LNewVal

End Sub

thanks for your help in any case, i think this coding is a bit mor
straight forward for me.

Z

--
Message posted from http://www.ExcelForum.com