ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel (https://www.excelbanter.com/excel-worksheet-functions/17635-excel.html)

moggy

Excel
 
i want to increase a field by 1 every time a specific file is opened

Rowan

Add the following code to the ThisWorkbook code sheet in the Visual Basic
Editor.

Private Sub Workbook_Open()
Dim targetCell As Range
Set targetCell = Sheets("Sheet1").Range("A2") 'change to required cell
targetCell.Value = targetCell.Value + 1
End Sub

Regards
Rowan

"moggy" wrote:

i want to increase a field by 1 every time a specific file is opened



All times are GMT +1. The time now is 04:55 AM.

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