ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Numbering Sheets incrementally (as in Invoice numbers) (https://www.excelbanter.com/new-users-excel/122456-numbering-sheets-incrementally-invoice-numbers.html)

Steve

Numbering Sheets incrementally (as in Invoice numbers)
 
With the least amount of keystrokes, how can I have a number that is typed in
cell J5 on 32 sheets in a workbook increase AUTOMATICALLY by one.
On the first sheet, I type 1000 in cell J5.
Automatically then I want cell J5 on sheet 2 to say 1001,
and so on up to 1032.

PLEASE GIVE ME EVERY STEP, since I have never entered a macro before,ie, I
don't know exactly where to enter it, how to save it, how to run it, etc.

JMB

Numbering Sheets incrementally (as in Invoice numbers)
 
I would use John Walkenbach's SheetOffset function here
http://www.j-walk.com/ss/excel/tips/tip63.htm

and I will include John's code that can be copied directly into a VBA module:

Function SHEETOFFSET(offset, Ref)
' Returns cell contents at Ref, in sheet offset
Application.Volatile
With Application.Caller.Parent
SHEETOFFSET = .Parent.Sheets(.Index + offset) _
.Range(Ref.Address).Value
End With
End Function


In your first worksheet, put 1000 in cell J5, then select your other 31
sheets (hold down the control key and use the mouse to select all of the
other sheets) and enter
=sheetoffset(-1, J5)+1
in cell J5, which will be entered in all 31 sheets. Hit enter.

For tutorials on navigating the VBA editor see David McRitchies site (The
first two links are to the two tutorials that I think will help you the most,
the third is the main page):

http://www.mvps.org/dmcritchie/excel/install.htm
http://www.mvps.org/dmcritchie/excel/getstarted.htm
http://www.mvps.org/dmcritchie/excel/excel.htm


"STEVE" wrote:

With the least amount of keystrokes, how can I have a number that is typed in
cell J5 on 32 sheets in a workbook increase AUTOMATICALLY by one.
On the first sheet, I type 1000 in cell J5.
Automatically then I want cell J5 on sheet 2 to say 1001,
and so on up to 1032.

PLEASE GIVE ME EVERY STEP, since I have never entered a macro before,ie, I
don't know exactly where to enter it, how to save it, how to run it, etc.



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com