usage counter

synergy16

Active Member
Joined
Mar 17, 2016
Messages
420
Office Version
  1. 365
Platform
  1. Windows
Good afternoon all. is there a function in VBA to have a "counter" to record how many times a form gets used?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You could run a Workbook_Open procedure (VBA code that runs automatically runs upon opening that does the following):
- Updates a value in some hidden or remote somewhere, incrementing it by 1, i.e.
Code:
Range("Z1000") = Range("Z1000") + 1
- Immediately saves the file (so that the update is recorded/saved).

The only caveat is that if they do not enable VBA, the code won't run.
 
Last edited:
Upvote 0
So, you would have code that looks something like this in the "ThisWorkbook" module of your workbook:
Code:
Private Sub Workbook_Open()
    Sheets("Sheet1").Range("Z1000") = Sheets("Sheet1").Range("Z1000") + 1
    ActiveWorkbook.Save
End Sub
Adjust sheet name and range to suit.
 
Upvote 0
If you're referring to a UserForm, then you could put something like Joe4 has shown in either the Initialise event, or in a command button event, depending on what you need.
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top