LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Incrementing no.s creating new but not changing no. opening saved

I have used the following steps to automatically populate the PO number field
in a Purchase Order file, based on a template, with an incremental number .
It works perfectly!!

1. Create a folder called Base Data and within it create a file called
PONumber.xls

2. Type the next new PO number in cell A1 of Sheet1.

3. Press Alt+F11 and double click on the "This Workbook" node for
PONumber.xls. (Make sure it says "PONumber -[ThisWookbook (Code)]" in the
title bar.)

4. Copy and paste in the following code

Private Sub Workbook_Open()
Sheets("Sheet1").Select
Dim number
number = Range("A1").Value
number = number + 1
Range("A1").Value = number
Range("A1").Select
End Sub

5. Save and close this file.

6. Open your PO template file and in the cell where you want the number to
appear type this formula:

='C:\Base Data\[PONumber.xls]Sheet1'!$A$1

in the cell where you want the number to appear.

7. Press Alt +F11 and double click on the "ThisWorkbook" node for your
template (check the title bar) then copy and paste in the following code:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Workbooks.Open Filename:="C:\Base Data\PONumber.xls"
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub

8. Save the template

HOWEVER, whenever I later open the saved populated Purchase Order the
numbers is changed. For examplte, if when the file was populated the PO
number was "PO0115" and a number of new POs have been saved since the
original file was created, when I open file "PO0115" it's PO number on screen
changes to the next new number held in my PONumber file e.g. "PO0119". How
do I stop this?
 
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
Shared file not opening to a saved point Steve Excel Discussion (Misc queries) 2 October 4th 07 05:21 PM
problem opening saved files gnjmh New Users to Excel 7 September 7th 07 03:24 AM
Opening saved workbook DM Excel Discussion (Misc queries) 1 June 13th 07 12:55 PM
Opening saved Excel files Ray New Users to Excel 2 July 2nd 06 12:28 PM
Error when opening a saved worksheet Kim Excel Worksheet Functions 2 October 3rd 05 05:21 PM


All times are GMT +1. The time now is 08:32 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"