LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Increment Purchase Order Number

Hi Paul,
Thanks for your response. I was able to quickly find the code for what I
want from the site you recommended. The problem is, it's not producing the
expected result. Here's the code which, when put in a template's
ThisWorkbook code module, should produce an incremented sequential number
each time the template is used to generate a document:

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

My result: When I choose to "enable macros", nothing happens. I've
duplicated the sample worksheet to ensure that the cell references in this
macro reflect properly in my worksheet. I've also named the template
"Invoice" and renamed sheet1 "Invoice".

Hopefully, this is possible for a VB newbie.
Thanks again, Lorrie

"Paul B" wrote:

Curious, have a look here,

http://www.mcgimpsey.com/excel/udfs/sequentialnums.html
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"Curious" wrote in message
...
Hi,
I've just looked through several functions to look for a way to increment
a
number each time a template is opened. It's proving to consume more time
than anticipated.

Can anyone help?
Thanks!




 
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
Setup Purchase Order Template to have a automatic number system? LynnB Excel Worksheet Functions 2 July 19th 06 03:08 AM
Increment/Increment letter in alphabetical order Neil Goldwasser Excel Programming 3 January 25th 06 09:07 AM
Purchase order dee Excel Discussion (Misc queries) 2 October 25th 05 01:39 AM
purchase order counter in excel purchase order template Brandy@baoco Excel Worksheet Functions 0 February 23rd 05 06:17 PM
I want a purchase order that includes page number (if to be order. Angela New Users to Excel 1 December 3rd 04 04:39 PM


All times are GMT +1. The time now is 05:06 PM.

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"