Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default In Excell ,formula

I want to generate a new number sequentially everytime I open my excell
document.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 268
Default In Excell ,formula

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


"housedoc" wrote:

I want to generate a new number sequentially everytime I open my excell
document.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default In Excell ,formula

Thank you i will try it.

"kassie" wrote:

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


"housedoc" wrote:

I want to generate a new number sequentially everytime I open my excell
document.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lost all excell files ACyahoo Excel Discussion (Misc queries) 0 September 14th 06 05:42 PM
Can I view an excell document without excell (not installed wit. Gordon Excel Discussion (Misc queries) 8 May 2nd 06 05:41 AM
insert query into excell sheet to update excell sheet and pivot table vbsolo Excel Discussion (Misc queries) 0 August 24th 05 12:41 PM
Can I view an excell document without excell (not installed wit. Kevin Excel Discussion (Misc queries) 1 February 16th 05 08:27 PM
lable ranges in Excell david Excel Discussion (Misc queries) 2 February 2nd 05 11:26 PM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"