![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Mar 2004
Location: Sheffield, Yorkshire
Posts: 4
|
I have an accounts spreadsheet that renews each week. What I am trying to do is to have the accounts serialised, 001, 002, 003 etc on a weekly basis. I want the serial no to increment automatically when spreadsheet is archived.
Andy |
|
|
|
|
|
#2 |
|
Join Date: Sep 2002
Location: Michigan
Posts: 1,132
|
Hey Andy, is the serial number the name of the Sheet? or a Column heading?...or something else...
Could you post a small example? Dave
__________________
Using Windows XP with Office XP |
|
|
|
|
|
#3 |
|
Join Date: Mar 2004
Location: Sheffield, Yorkshire
Posts: 4
|
Dave - the serial number is to be used to avoid fraud on the account - if each time the account is saved the serial number (a formula in a protected cell??) is incremented by 1. That way I can have a trail of all entries onto the account. Several people use the spreadsheet in different locations. Does that explain the problem better
|
|
|
|
|
|
#4 |
|
Join Date: Sep 2002
Location: Michigan
Posts: 1,132
|
Ok...let's see if I got this right...so the number is in a cell, and you want the number to increase by 1 each time you save the workbook without any input by a user? If that's right, let me know...I'm on my Mac at home right now...and I hate Excel on the Mac...it's not the same even though they say it is....
Have a good day, Dave P.S...and is that every time the workbook is saved...or everytime it's opened?
__________________
Using Windows XP with Office XP |
|
|
|
|
|
#5 |
|
Join Date: Mar 2004
Location: Sheffield, Yorkshire
Posts: 4
|
Dave - Yes that is what I am trying to do. Increment the number everytime the spreadsheet is closed.
Andy |
|
|
|
|
|
#6 |
|
Join Date: Sep 2002
Location: Michigan
Posts: 1,132
|
This should do the trick...copy and paste this into the "Thisworkbook" object...
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Worksheets("Sheet1").Range("A1") = Range("A1") + 1
ActiveWorkbook.Save
End Sub
Hope this helps and have a good day, Dave
__________________
Using Windows XP with Office XP |
|
|
|
|
|
#7 |
|
Join Date: Mar 2004
Location: Sheffield, Yorkshire
Posts: 4
|
Dave - Thanks a lot for the time. I haven't tried it yet but will do as soon as I get the chance. Andy
|
|
|
|
|
|
#8 |
|
Join Date: Sep 2002
Location: Michigan
Posts: 1,132
|
Good luck Andy, let me know how it goes....
Dave |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|