#1   Report Post  
Posted to microsoft.public.excel.misc
abcdexcel
 
Posts: n/a
Default Sequential Numbers


Hi

I have got the code for sequential numbers from McGimpsey's website. Is
there a code, that the numbers restart on every change in month.

Thanks
SAS


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=501060

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Sequential Numbers

You could add some code to test whether the date is the 1st and reset to
one, but is it possible that the workbook is opened more than once in a day?

BTW, which version are u using, registry or text file?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"abcdexcel" wrote
in message ...

Hi

I have got the code for sequential numbers from McGimpsey's website. Is
there a code, that the numbers restart on every change in month.

Thanks
SAS


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile:

http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=501060



  #3   Report Post  
Posted to microsoft.public.excel.misc
abcdexcel
 
Posts: n/a
Default Sequential Numbers


Hi

Using the text file version.

There always be more than one invoice in a day.


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile: http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=501060

  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Sequential Numbers

Try this

Public Function NextSeqNumber(Optional sFileName As String, _
Optional nSeqNumber As Long = -1) As Long
Const sDEFAULT_PATH As String = "C:\"
Const sDEFAULT_FNAME As String = "defaultseq.txt"
Dim nFileNumber As Long
Dim nDate As String

nFileNumber = FreeFile
If sFileName = "" Then sFileName = sDEFAULT_FNAME
If InStr(sFileName, Application.PathSeparator) = 0 Then _
sFileName = sDEFAULT_PATH & Application.PathSeparator & sFileName
If nSeqNumber = -1& Then
If Dir(sFileName) < "" Then
Open sFileName For Input As nFileNumber
Input #nFileNumber, nSeqNumber, nDate
If Month(CDate(nDate)) < Month(Date) Then
nSeqNumber = 1&
Else
nSeqNumber = nSeqNumber + 1&
End If
Close nFileNumber
Else
nSeqNumber = 1&
End If
End If
On Error GoTo PathError
Open sFileName For Output As nFileNumber
On Error GoTo 0
Print #nFileNumber, nSeqNumber, Format(Date, "dd mmm yyyy")
Close nFileNumber
NextSeqNumber = nSeqNumber
Exit Function
PathError:
NextSeqNumber = -1&
End Function


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"abcdexcel" wrote
in message ...

Hi

Using the text file version.

There always be more than one invoice in a day.


--
abcdexcel
------------------------------------------------------------------------
abcdexcel's Profile:

http://www.excelforum.com/member.php...o&userid=30021
View this thread: http://www.excelforum.com/showthread...hreadid=501060



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
Make sequential numbers each time sheet is opened Darrell Shuman Excel Worksheet Functions 1 October 19th 05 03:35 AM
How to make excel not round real numbers when making a histogram? Leedawg Charts and Charting in Excel 1 September 21st 05 07:36 PM
How do I assign sequential numbers in an invoice? halex New Users to Excel 4 May 5th 05 06:46 PM
Sorting when some numbers have a text suffix confused on the tundra Excel Discussion (Misc queries) 5 December 18th 04 10:19 PM
sequential numbers on invoices Tony Excel Worksheet Functions 2 December 2nd 04 11:05 PM


All times are GMT +1. The time now is 09:25 PM.

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

About Us

"It's about Microsoft Excel"