View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Richard Buttrey
 
Posts: n/a
Default Need a formula to create an order number

On Fri, 5 May 2006 17:56:40 -0500, slorryy
wrote:


Hi People

I am trying to deign a form and excel.

I need a function to auto create a order number (basically a
function/formula that add 1 onto the previous order number when a new
order is created)

Hope that makes sence

Any help would be fab

Mark


Perhaps the simplest way is to hold the current order number as a
variable in a cell. Then with the event that triggers a new order, add
a line of code that increases the order number variable by 1.

So suppose your order numbers are are of the form ON1234, ON1235 etc,
where there is a prefix "ON" to a sequential number, and the variable
cell is named say "Onumber"

add a line of code

Range("Onumber")= "ON" & Right(Range("Onumber"), Len(Range("Onumber"))
- 2) + 1


HTH
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________