owentmoore
Technical User
I have a file containing many pivot tables. I do not want all of these pivot table to refresh when I open them, only the activesheet. In this way I can reduce the time to open.
I want to select a sheet and in the worksheet activate event, count how many times the sheet has been open. If it has not been opened (since the file was opened), then I will run a macro. I'll then need to increment the counter. If it has been opened I will not run the macro.
I've sample code pasted below. The problem with it is that it is not storing the value that is incremented. How do I do this?
I want to select a sheet and in the worksheet activate event, count how many times the sheet has been open. If it has not been opened (since the file was opened), then I will run a macro. I'll then need to increment the counter. If it has been opened I will not run the macro.
I've sample code pasted below. The problem with it is that it is not storing the value that is incremented. How do I do this?
Code:
Private Sub Worksheet_Activate()
Dim i As Integer
If i = 0 Then
i = i + 1
....do various tasks....
Else
.... do various tasks....
End If
End Sub