M
Mark1
Ok, I've made some VBA code that keeps track of how many
times a spreadsheet is open. That value shows up on my
spreadsheet in cell A1. When the spreadsheet is open,
that number increases by one. Problem: when the user
closes down the spreadsheet they are asked if they want to
save changes. If they hit No, the counter will revert
back to the previous value (the eighth user opens the
spreadsheet, the value in A1 goes to eight; but if they
don't save changes, the value goes back to seven).
Here's what I want: I want VBA to store the value, and
increase it by one on open, without displaying the value
on the spreadsheet. Thereby, the user would not be asked
if he/she wants to save changes. Here's my code, so far:
Public Sub Workbook_Open()
a = Worksheets("Sheet1").Range("A1").Value
a = AdditionA(a)
Worksheets("Sheet1").Range("A1").Value = a
End Sub
Function AdditionA(b)
AdditionA = b + 1
End Function
Help is appreciated!!
times a spreadsheet is open. That value shows up on my
spreadsheet in cell A1. When the spreadsheet is open,
that number increases by one. Problem: when the user
closes down the spreadsheet they are asked if they want to
save changes. If they hit No, the counter will revert
back to the previous value (the eighth user opens the
spreadsheet, the value in A1 goes to eight; but if they
don't save changes, the value goes back to seven).
Here's what I want: I want VBA to store the value, and
increase it by one on open, without displaying the value
on the spreadsheet. Thereby, the user would not be asked
if he/she wants to save changes. Here's my code, so far:
Public Sub Workbook_Open()
a = Worksheets("Sheet1").Range("A1").Value
a = AdditionA(a)
Worksheets("Sheet1").Range("A1").Value = a
End Sub
Function AdditionA(b)
AdditionA = b + 1
End Function
Help is appreciated!!