In Excell ,formula

K

kassie

Cannot even remember where I got this, but hey, it works like a charm!

Private Sub Workbook_Open()
Const sAPpplicationAs String = "Excel"
Const sSectionAs String = "Quote"
Const sKey As String = "Quotation_key"
Const nDefault As Long = 1&
Dim nQuotNumber As Long

With ThisWorkbook.Sheets("Quotation")
With .Range("Number")
If Not IsEmpty(.Value) Then
nQuotNumber = Range("Number")
SaveSetting sApplication, sSection, sKey, nQuotNumber + 1&
End If
End With
With .Range("Number")
If IsEmpty(.Value) Then
nquotNumber = GetSetting(sApplication, sSection, sKey,
nDefault)
.NumberFormat = "@"
.Value = Format(nquotNumber, "0000")
SaveSetting sAPpplication, sSection, sKey, nquotNumber +
1&
End If
End With
End With
End Sub
 
H

housedoc

Thank you i will try it.

kassie said:
Cannot even remember where I got this, but hey, it works like a charm!

Private Sub Workbook_Open()
Const sAPpplicationAs String = "Excel"
Const sSectionAs String = "Quote"
Const sKey As String = "Quotation_key"
Const nDefault As Long = 1&
Dim nQuotNumber As Long

With ThisWorkbook.Sheets("Quotation")
With .Range("Number")
If Not IsEmpty(.Value) Then
nQuotNumber = Range("Number")
SaveSetting sApplication, sSection, sKey, nQuotNumber + 1&
End If
End With
With .Range("Number")
If IsEmpty(.Value) Then
nquotNumber = GetSetting(sApplication, sSection, sKey,
nDefault)
.NumberFormat = "@"
.Value = Format(nquotNumber, "0000")
SaveSetting sAPpplication, sSection, sKey, nquotNumber +
1&
End If
End With
End With
End Sub
 
Top