Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Only vba code can do this. Something like this will work
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.ActiveSheet With .Range("B1") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "1") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Bcoleman75" wrote: I need the formula or path to i guess to make a template and each time it is open it generates a new number, Like a invoice number. For example. in cell A1 Invoice # in cell B1 we would have the number 1. then save it and then when you open the template again the #2 would be in cell B1 automatically? can anyone help? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
mike thank you but i am very very basic wth this vba codes etc. I don't know
where to begin, do I just copy and past what you have and it should work? "Mike" wrote: Only vba code can do this. Something like this will work 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.ActiveSheet With .Range("B1") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "1") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Bcoleman75" wrote: I need the formula or path to i guess to make a template and each time it is open it generates a new number, Like a invoice number. For example. in cell A1 Invoice # in cell B1 we would have the number 1. then save it and then when you open the template again the #2 would be in cell B1 automatically? can anyone help? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I could send you a workbook that is working. Or yes you can just copy and
paste the code into the ThisWorkBook Module. "Bcoleman75" wrote: mike thank you but i am very very basic wth this vba codes etc. I don't know where to begin, do I just copy and past what you have and it should work? "Mike" wrote: Only vba code can do this. Something like this will work 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.ActiveSheet With .Range("B1") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "1") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Bcoleman75" wrote: I need the formula or path to i guess to make a template and each time it is open it generates a new number, Like a invoice number. For example. in cell A1 Invoice # in cell B1 we would have the number 1. then save it and then when you open the template again the #2 would be in cell B1 automatically? can anyone help? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
if you have a work book and don't mind sharing that would be great, i've been
working on this for almost 6 wks and there is no software out there to generate sequnital number system and i just need a code through vb i guess....thanks for all your help!!!! "Mike" wrote: I could send you a workbook that is working. Or yes you can just copy and paste the code into the ThisWorkBook Module. "Bcoleman75" wrote: mike thank you but i am very very basic wth this vba codes etc. I don't know where to begin, do I just copy and past what you have and it should work? "Mike" wrote: Only vba code can do this. Something like this will work 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.ActiveSheet With .Range("B1") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "1") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Bcoleman75" wrote: I need the formula or path to i guess to make a template and each time it is open it generates a new number, Like a invoice number. For example. in cell A1 Invoice # in cell B1 we would have the number 1. then save it and then when you open the template again the #2 would be in cell B1 automatically? can anyone help? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Where do I send it to
"Bcoleman75" wrote: if you have a work book and don't mind sharing that would be great, i've been working on this for almost 6 wks and there is no software out there to generate sequnital number system and i just need a code through vb i guess....thanks for all your help!!!! "Mike" wrote: I could send you a workbook that is working. Or yes you can just copy and paste the code into the ThisWorkBook Module. "Bcoleman75" wrote: mike thank you but i am very very basic wth this vba codes etc. I don't know where to begin, do I just copy and past what you have and it should work? "Mike" wrote: Only vba code can do this. Something like this will work 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.ActiveSheet With .Range("B1") If IsEmpty(.Value) Then nNumber = GetSetting(sAPPLICATION, sSECTION, sKEY, nDEFAULT) .NumberFormat = "@" .Value = Format(nNumber, "1") SaveSetting sAPPLICATION, sSECTION, sKEY, nNumber + 1& End If End With End With End Sub "Bcoleman75" wrote: I need the formula or path to i guess to make a template and each time it is open it generates a new number, Like a invoice number. For example. in cell A1 Invoice # in cell B1 we would have the number 1. then save it and then when you open the template again the #2 would be in cell B1 automatically? can anyone help? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Bring focus to same cell every time opened?? | Excel Discussion (Misc queries) | |||
how do i have a cell number increase by 1 each time file opened | Excel Discussion (Misc queries) | |||
Saved Changes Gone Next Time Document is Opened | Excel Discussion (Misc queries) | |||
have invoice # roll up, or add 1, each time document is opened | Excel Worksheet Functions | |||
Make sequential numbers each time sheet is opened | Excel Worksheet Functions |