#1   Report Post  
Posted to microsoft.public.excel.misc
Globe Director
 
Posts: n/a
Default Can Excel AutoNumber

Can a cell be set up to function as AutoNumber does in MS Access? Each time
a worksheet is opened the cell increments one number, or can a macro be
generated to do this function after the workbook is opened?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary L Brown
 
Posts: n/a
Default Can Excel AutoNumber

To increment a number by 1 everytime a worksheet is activated, put the
following code in that worksheet's module.

To do that, get into the VBE (Alt-F11). In the Project window,
double-left-click on the worksheet you want to use. In the Code window (to
the right of the Project window), put the following code.

'/===============================/
Private Sub Worksheet_Activate()
Range("A1").Value = Range("A1").Value + 1
End Sub
'/===============================/

"A1" can actually be any cell you want the number to appear in.

HTH
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Globe Director" wrote:

Can a cell be set up to function as AutoNumber does in MS Access? Each time
a worksheet is opened the cell increments one number, or can a macro be
generated to do this function after the workbook is opened?

  #3   Report Post  
Posted to microsoft.public.excel.misc
Globe Director
 
Posts: n/a
Default Can Excel AutoNumber

Gary,
Thanks!!! I put your code into the WorkBook's module, and each time the
file is opened the cell increments. FYI this is for a Return Material
Authorization form.

Globe Director

"Gary L Brown" wrote:

To increment a number by 1 everytime a worksheet is activated, put the
following code in that worksheet's module.

To do that, get into the VBE (Alt-F11). In the Project window,
double-left-click on the worksheet you want to use. In the Code window (to
the right of the Project window), put the following code.

'/===============================/
Private Sub Worksheet_Activate()
Range("A1").Value = Range("A1").Value + 1
End Sub
'/===============================/

"A1" can actually be any cell you want the number to appear in.

HTH
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Globe Director" wrote:

Can a cell be set up to function as AutoNumber does in MS Access? Each time
a worksheet is opened the cell increments one number, or can a macro be
generated to do this function after the workbook is opened?

  #4   Report Post  
Junior Member
 
Posts: 4
Default

I am working on a spreadsheet with the following field Reference number, Location, Date Raised, Priority of Request, Faculty and department. I want the reference number to be an auto number, therefore I have tried out the code below. However, when I fill in the information the autonumber isn't generated. What should I be doing?

Thanks

------------------------------------------------------------------------------------------
Quote:
Originally Posted by Globe Director
Gary,
Thanks!!! I put your code into the WorkBook's module, and each time the
file is opened the cell increments. FYI this is for a Return Material
Authorization form.

Globe Director

"Gary L Brown" wrote:

To increment a number by 1 everytime a worksheet is activated, put the
following code in that worksheet's module.

To do that, get into the VBE (Alt-F11). In the Project window,
double-left-click on the worksheet you want to use. In the Code window (to
the right of the Project window), put the following code.

'/===============================/
Private Sub Worksheet_Activate()
Range("A1").Value = Range("A1").Value + 1
End Sub
'/===============================/

"A1" can actually be any cell you want the number to appear in.

HTH
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Globe Director" wrote:

Can a cell be set up to function as AutoNumber does in MS Access? Each time
a worksheet is opened the cell increments one number, or can a macro be
generated to do this function after the workbook is opened?
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
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
convert pocket excel back to standard excel kevroyal Excel Discussion (Misc queries) 1 February 16th 06 11:35 AM
excel - autonumber feature JAM Excel Worksheet Functions 1 December 10th 05 11:19 AM
VBA for Excel 2000 file is corrupt nkamp Excel Discussion (Misc queries) 0 May 26th 05 03:37 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


All times are GMT +1. The time now is 11:22 AM.

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"