Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default 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!!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default 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!!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default 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!!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default 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!!

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
A number of auto filters in one sheet. Janis Excel Discussion (Misc queries) 7 July 7th 07 08:40 PM
A number of auto filters in one sheet? Is it possible? Janis Excel Discussion (Misc queries) 2 July 2nd 07 10:54 PM
Excel worksheet - Can I make changes in one sheet affect contents of other sheet? [email protected] Excel Discussion (Misc queries) 3 July 11th 06 03:34 PM
cutting and pasting rows from one sheet to another generates error JT Spitz Excel Discussion (Misc queries) 7 February 14th 06 07:06 PM
Excel Analysis Add-in EOMONTH generates #NAME? error Ray Excel Worksheet Functions 6 July 18th 05 07:00 PM


All times are GMT +1. The time now is 01:32 PM.

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

About Us

"It's about Microsoft Excel"