ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   number sequence generator (https://www.excelbanter.com/excel-programming/364834-number-sequence-generator.html)

Larry

number sequence generator
 
Hi I am trying to create a sequential number generator in a workbook so that
each time it is accessed the next open cell will autofill with the next
higher number. I need it to do this from 150 to 10,000. I've tried to create
a couple macros, don't know much about pivot tables.
Any help? Thanks

DS

number sequence generator
 
Hi Larry,

one of the more experienced bods may be able to come up with something a
little more elegant, but in the meantime this may help!

Private Sub Workbook_Open()
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.Value = Selection.Offset(-1, 0).Value + 1
End Sub

Put the above in the ThisWorkbook (rather than a module or Sheet), and it
will enter the next number in line in the next empty cell in Col A. You'll
need to put "150" in A1 to start it off. Each time the workbook is opened
after this, the next cell down will complete with +1 on the previous.

HTH
DS

"Larry" wrote:

Hi I am trying to create a sequential number generator in a workbook so that
each time it is accessed the next open cell will autofill with the next
higher number. I need it to do this from 150 to 10,000. I've tried to create
a couple macros, don't know much about pivot tables.
Any help? Thanks


Larry

number sequence generator
 
Ds,
this works great. I have changed to require 1 - 5000 using several different
numbers up to 800, each will identify a tab in a workbook set up by year,
each tab represents data on a piece of equipment. I may even link the number
generated to the tabs. Now I just have to open the page 800 times to set the
numbers! Kidding, I think I will set the cells up to 800 first then go from
there. I'm thinking I can relace A1 with the cell A800. Anyhoo, thanks a
bunch, this will do the job.

"DS" wrote:

Hi Larry,

one of the more experienced bods may be able to come up with something a
little more elegant, but in the meantime this may help!

Private Sub Workbook_Open()
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.Value = Selection.Offset(-1, 0).Value + 1
End Sub

Put the above in the ThisWorkbook (rather than a module or Sheet), and it
will enter the next number in line in the next empty cell in Col A. You'll
need to put "150" in A1 to start it off. Each time the workbook is opened
after this, the next cell down will complete with +1 on the previous.

HTH
DS

"Larry" wrote:

Hi I am trying to create a sequential number generator in a workbook so that
each time it is accessed the next open cell will autofill with the next
higher number. I need it to do this from 150 to 10,000. I've tried to create
a couple macros, don't know much about pivot tables.
Any help? Thanks


Larry

number sequence generator
 
Thanks DS,
I think this will do nicely. I have changed my range to:1-5000. I need to
use various numbers between 1-800 so I think I will populate the cells first
and change A1 to A800; should start from there? Anyhoo, I appreciate the
quick response. Take care, larry

"DS" wrote:

Hi Larry,

one of the more experienced bods may be able to come up with something a
little more elegant, but in the meantime this may help!

Private Sub Workbook_Open()
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.Value = Selection.Offset(-1, 0).Value + 1
End Sub

Put the above in the ThisWorkbook (rather than a module or Sheet), and it
will enter the next number in line in the next empty cell in Col A. You'll
need to put "150" in A1 to start it off. Each time the workbook is opened
after this, the next cell down will complete with +1 on the previous.

HTH
DS

"Larry" wrote:

Hi I am trying to create a sequential number generator in a workbook so that
each time it is accessed the next open cell will autofill with the next
higher number. I need it to do this from 150 to 10,000. I've tried to create
a couple macros, don't know much about pivot tables.
Any help? Thanks



All times are GMT +1. The time now is 03:10 AM.

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