Storing non-user data

  • Thread starter Thread starter ChrisJForeman
  • Start date Start date
C

ChrisJForeman

I have just created a VBA input module (as per my previous posting when I
forgot to ask this question!) and want to maintain a count of the rows used so
that I can add new data to the next available row.
Where can I store this count so that it is carried between sessions, but not
visible/changeable on the worksheet.

TIA

Chris
 
Chris
You could store the value in a hidden cell, or hidden worksheet (use very
hidden property set in VBA) to prevent users unhiding the sheet. This
method will mean the value is stored with the application. Use the workbook
open or form initialize events to get the value of the counter.

An alternative (basics shown below) is to store the value in the system
registry, however this is machine specific, so if you have multiple users
sharing this over a network this is not a good choice.

' use this template to store a value in the registry
SaveSetting APPNAME, "Defaults", CounterValue, Value
' use this template to read the registry
VBA.GetSetting (APPNAME, "Defaults", CounterValue, Value)

Cheers
N
 
Back
Top