View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default How do you add 1 to an invoice number in Excel. Formula for this?

Hi. This is similar to Bob's excellent idea. Would anything here work for
you?

Private Sub Workbook_Open()
On Error Resume Next
ThisWorkbook.Names.Add "InvoiceNumber", [InvoiceNumber] + 1
If Err.Number 0 Then ThisWorkbook.Names.Add "InvoiceNumber", 1

'// You can put the current value of Invoice in a cell...
[A1] = [InvoiceNumber]
'or ...
Range("A2") = ThisWorkbook.Names("InvoiceNumber").Value
End Sub

--
Dana DeLouis
Win XP & Office 2003


"GregR" wrote in message
oups.com...
Bob, what it means is I have defined "F4" by the user name "Inv". I
thought that's what you meant by "define a name in your workbook". HTH

Greg