ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   increment version number (https://www.excelbanter.com/excel-discussion-misc-queries/88866-increment-version-number.html)

Lozza77

increment version number
 
Is there anyway to automatically increment a number in a spreadsheet
everytime the document is saved? ie version number?

Ardus Petus

increment version number
 
Paste following code in Workbook's code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Me.Worksheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub

HTH
--
AP

"Lozza77" a écrit dans le message de
news: ...
Is there anyway to automatically increment a number in a spreadsheet
everytime the document is saved? ie version number?




Lozza77

increment version number
 
Thanks Ardus.

How do you edit the workbooks code or do you mean paste it into a cell?
Sorry - I'm a novice!

Regards,
Louren.



"Ardus Petus" wrote:

Paste following code in Workbook's code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Me.Worksheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub

HTH
--
AP

"Lozza77" a écrit dans le message de
news: ...
Is there anyway to automatically increment a number in a spreadsheet
everytime the document is saved? ie version number?





Ardus Petus

increment version number
 
Right-click on the Excel icon on top left of your worksheet,
then select Code.
Paste the code in the newly opened window.
Get back to Excel (vlick on Excel icon)

Save your workbook: the version number will go up by 1

HTH
--
AP

"Lozza77" a écrit dans le message de
news: ...
Thanks Ardus.

How do you edit the workbooks code or do you mean paste it into a cell?
Sorry - I'm a novice!

Regards,
Louren.



"Ardus Petus" wrote:

Paste following code in Workbook's code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Me.Worksheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub

HTH
--
AP

"Lozza77" a écrit dans le message de
news:
...
Is there anyway to automatically increment a number in a spreadsheet
everytime the document is saved? ie version number?







Lozza77

increment version number
 
Brilliant!

That works perfectly - thanks very much Ardus.

"Ardus Petus" wrote:

Paste following code in Workbook's code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Me.Worksheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub

HTH
--
AP

"Lozza77" a écrit dans le message de
news: ...
Is there anyway to automatically increment a number in a spreadsheet
everytime the document is saved? ie version number?






All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com