![]() |
How to make excel sheet generates an auto number
Greeting,
I have work book and I need this work book generates an auto number. For example, when I open this sheet for the first time, A1 =1, next time =2 and so on. Is that possible in excel??? Thanks!! |
How to make excel sheet generates an auto number
Put in ThisWorkbook module
Private Sub Workbook_Open() [A1]=[A1]+1 End Sub "ghost" skrev: Greeting, I have work book and I need this work book generates an auto number. For example, when I open this sheet for the first time, A1 =1, next time =2 and so on. Is that possible in excel??? Thanks!! |
How to make excel sheet generates an auto number
Add this code in excel:
Private Sub Workbook_Open() Dim i As Integer Dim iValue As Integer Dim iStart As Integer Dim iIncrement As Integer i = 1 iStart = 1 'Here you can define the starting value iIncrement = 1 'Here you can define the incremenatal value If Cells(1, 1).Value = "" Then Cells(1, 1).Value = iStart Else While Cells(i, 1).Value < "" iValue = Cells(i, 1).Value i = i + 1 Wend Cells(i, 1).Value = iValue + iIncrement End If ActiveWorkbook.Save End Sub Thanks, Mahesh "ghost" wrote: Greeting, I have work book and I need this work book generates an auto number. For example, when I open this sheet for the first time, A1 =1, next time =2 and so on. Is that possible in excel??? Thanks!! |
How to make excel sheet generates an auto number
it works.
thanks a lot "Mahesh" wrote: Add this code in excel: Private Sub Workbook_Open() Dim i As Integer Dim iValue As Integer Dim iStart As Integer Dim iIncrement As Integer i = 1 iStart = 1 'Here you can define the starting value iIncrement = 1 'Here you can define the incremenatal value If Cells(1, 1).Value = "" Then Cells(1, 1).Value = iStart Else While Cells(i, 1).Value < "" iValue = Cells(i, 1).Value i = i + 1 Wend Cells(i, 1).Value = iValue + iIncrement End If ActiveWorkbook.Save End Sub Thanks, Mahesh "ghost" wrote: Greeting, I have work book and I need this work book generates an auto number. For example, when I open this sheet for the first time, A1 =1, next time =2 and so on. Is that possible in excel??? Thanks!! |
All times are GMT +1. The time now is 03:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com