Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm creating a Purchase Order, and I want to have the number increased to the
next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You would need VBA
http://www.mcgimpsey.com/excel/udfs/sequentialnums.html on how to get started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards, Peo Sjoblom "David" wrote in message ... I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Peo,
I'm getting a "script out of range" error on line 7 (With ThisWorkbook.. Private Sub Workbook_Open() Const sAPPLICATION As String = "Excel" Const sSECTION As String = "Invoice" Const sKEY As String = "Invoice_key" Const nDEFAULT As Long = 1& Dim nNumber As Long With ThisWorkbook.Sheets("Invoice") With .Range("B1") If IsEmpty(.Value) Then .Value = Date .NumberFormat = "dd mmm yyyy" End If End With With .Range("B2") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "0000") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Peo Sjoblom" wrote: You would need VBA http://www.mcgimpsey.com/excel/udfs/sequentialnums.html on how to get started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards, Peo Sjoblom "David" wrote in message ... I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Are you using this in a sheet named "Invoice"?
-- Regards, Peo Sjoblom "David" wrote in message ... Peo, I'm getting a "script out of range" error on line 7 (With ThisWorkbook.. Private Sub Workbook_Open() Const sAPPLICATION As String = "Excel" Const sSECTION As String = "Invoice" Const sKEY As String = "Invoice_key" Const nDEFAULT As Long = 1& Dim nNumber As Long With ThisWorkbook.Sheets("Invoice") With .Range("B1") If IsEmpty(.Value) Then .Value = Date .NumberFormat = "dd mmm yyyy" End If End With With .Range("B2") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "0000") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Peo Sjoblom" wrote: You would need VBA http://www.mcgimpsey.com/excel/udfs/sequentialnums.html on how to get started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards, Peo Sjoblom "David" wrote in message ... I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Yes...I renamed the file "Invoice.xls".
Thanks, "David" wrote: Peo, I'm getting a "script out of range" error on line 7 (With ThisWorkbook.. Private Sub Workbook_Open() Const sAPPLICATION As String = "Excel" Const sSECTION As String = "Invoice" Const sKEY As String = "Invoice_key" Const nDEFAULT As Long = 1& Dim nNumber As Long With ThisWorkbook.Sheets("Invoice") With .Range("B1") If IsEmpty(.Value) Then .Value = Date .NumberFormat = "dd mmm yyyy" End If End With With .Range("B2") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "0000") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Peo Sjoblom" wrote: You would need VBA http://www.mcgimpsey.com/excel/udfs/sequentialnums.html on how to get started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards, Peo Sjoblom "David" wrote in message ... I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
The sheet that you are using it on has to be called Invoice for the
code to work - not the filename! Pete On Nov 21, 12:49 pm, David wrote: Yes...I renamed the file "Invoice.xls". Thanks, "David" wrote: Peo, I'm getting a "script out of range" error on line 7 (With ThisWorkbook.. Private Sub Workbook_Open() Const sAPPLICATION As String = "Excel" Const sSECTION As String = "Invoice" Const sKEY As String = "Invoice_key" Const nDEFAULT As Long = 1& Dim nNumber As Long With ThisWorkbook.Sheets("Invoice") With .Range("B1") If IsEmpty(.Value) Then .Value = Date .NumberFormat = "dd mmm yyyy" End If End With With .Range("B2") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "0000") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Peo Sjoblom" wrote: You would need VBA http://www.mcgimpsey.com/excel/udfs/sequentialnums.html on how to get started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards, Peo Sjoblom "David" wrote in message ... I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created?- Hide quoted text - - Show quoted text - |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This link explains how to do it:
http://www.mcgimpsey.com/excel/udfs/sequentialnums.html Hope this helps. Pete On Nov 20, 4:06 pm, David wrote: I'm creating a Purchase Order, and I want to have the number increased to the next number when I open the templet. Any ideas. For example, if the PO is 16500, then the next time I open the file, I want it to be 16501. Can this function be created? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
i want to calculate stocks. The percentage issued and value | Excel Discussion (Misc queries) | |||
Shifting Calculated Result - Re-Issued | Excel Worksheet Functions | |||
How do I create a function to search a range for a number and... | Excel Worksheet Functions | |||
Can software be downloaded to my laptop from CD issued with my n. | Excel Discussion (Misc queries) | |||
Create an Auto Number | Excel Worksheet Functions |