ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to increase a number by 1 every time the spreadsheet opens? (https://www.excelbanter.com/excel-discussion-misc-queries/242736-how-increase-number-1-every-time-spreadsheet-opens.html)

sld

How to increase a number by 1 every time the spreadsheet opens?
 
Is there a way to have a number increase by 1 every time the excel
spreadsheet opens?

Bernard Liengme[_3_]

How to increase a number by 1 every time the spreadsheet opens?
 
With a Workbook open even macro such as

Private Sub Workbook_Open()
Range("Sheet1!A1").Value = Range("Sheet1!A1").Value + 1
End Sub

Open the VBA editor, right click ThisWorkbook for the file in question and
use View Code
Paste this macro into the module

New to VBA? See

David McRitchie's site on "getting started" with VBA

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Debra Dalgleish's "Adding Code to a Workbook"

http://www.contextures.com:80/xlvba01.html

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"SLD" wrote in message
...
Is there a way to have a number increase by 1 every time the excel
spreadsheet opens?





All times are GMT +1. The time now is 08:45 AM.

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