EventLinelist

Encapsulates workbook-level linelist events and lazily-cached domain managers. This class is the single entry point for all event handling in the output linelist workbook. It reacts to sheet change (HList geo cascades, editable labels, list auto, go-to-section, multiple choices; VList editable labels and multiple choices; analysis go-to-section and spatial dispatch), sheet deactivate (list auto update), selection change (geo dropdown refresh), double-click (spatio-temporal geo form), filter table updates, list-auto dropdown maintenance, and geo/spatial UDF delegation.

Depends on: BetterArray, HiddenNames, DropdownLists, LLGeo, LLSpatial, LLdictionary, LLVariables, LLTranslation, TranslationObject, Passwords, ProjectError

Factory

Create #

Build a configured EventLinelist instance bound to a host workbook.

Signature:

Public Function Create(ByVal hostBook As Workbook) As IEventLinelist

Parameters:

  • hostBook: Workbook. The linelist workbook.

Returns: IEventLinelist. Configured service instance.

Throws:

  • ProjectError.ObjectNotInitialized When hostBook is Nothing.

IEventLinelist implementation

Configure #

Configure the service with its host workbook context.

Signature:

Public Sub Configure(ByVal hostBook As Workbook)

Parameters:

  • hostBook: Workbook. The linelist workbook.

Throws:

  • ProjectError.ObjectNotInitialized When hostBook is Nothing.

OnWorkbookOpen #

React to workbook open notifications.

Signature:

Public Sub OnWorkbookOpen()

OnSheetChange #

Handle worksheet change events.

Signature:

Public Sub OnSheetChange(ByVal sh As Worksheet, ByVal target As Range)

Parameters:

  • sh: Worksheet. The worksheet raising the change event.
  • target: Range. The edited cells.

OnSheetDeactivate #

Handle worksheet deactivation events.

Signature:

Public Sub OnSheetDeactivate(ByVal prevSheetName As String)

Parameters:

  • prevSheetName: String. Name of the sheet that was deactivated.

OnSelectionChange #

Handle selection change events on HList sheets.

Signature:

Public Sub OnSelectionChange(ByVal sh As Worksheet, ByVal target As Range)

Parameters:

  • sh: Worksheet. The worksheet where the selection changed.
  • target: Range. The newly selected cell(s).

OnDoubleClick #

Handle double-click events on analysis sheets.

Signature:

Public Sub OnDoubleClick(ByVal sh As Worksheet, ByVal target As Range)

Parameters:

  • sh: Worksheet. The worksheet where the double-click occurred.
  • target: Range. The double-clicked cell.

UpdateFilterTables #

Update filter tables used by analysis sheets.

Signature:

Public Sub UpdateFilterTables(Optional ByVal calculate As Boolean = True)

Parameters:

  • calculate: Optional Boolean. When True (default), recalculates the active sheet.

UpdateAllListAuto #

Update all list-auto dropdowns across all HList sheets.

Signature:

Public Sub UpdateAllListAuto()

ResetCaches #

Clear cached resources.

Signature:

Public Sub ResetCaches()

Geo / Spatial UDF delegation

GeoConcat #

Concatenate geo cells up to a given admin level.

Signature:

Public Function GeoConcat(ByVal cellRng As Range, ByVal geoLevel As Byte) As String

Parameters:

  • cellRng: Range. The first geo cell.
  • geoLevel: Byte. Number of admin levels to concatenate (1-4).

Returns: String. Pipe-delimited concatenation of non-empty admin values.


TopAdmin #

Return the top admin name for a spatial variable.

Signature:

Public Function TopAdmin(ByVal adminLevel As String, _
                         ByVal adminOrder As Integer, _
                         ByVal varName As String, _
                         Optional ByVal tabId As String = vbNullString) As String

Parameters:

  • adminLevel: String. Admin level label (e.g. "adm1").
  • adminOrder: Integer. Rank order (1 = top, 2 = second, etc.).
  • varName: String. Variable name (with prefix, e.g. "adm1_concat_adm1_myvar").
  • tabId: Optional String. Spatial table identifier.

Returns: String. Admin name at the given rank.


TopPop #

Return the population for the top admin of a spatial variable.

Signature:

Public Function TopPop(ByVal adminLevel As String, _
                       ByVal adminOrder As Integer, _
                       ByVal varName As String, _
                       Optional ByVal tabId As String = vbNullString) As Long

Parameters:

  • adminLevel: String. Admin level label (e.g. "adm1").
  • adminOrder: Integer. Rank order (1 = top, 2 = second, etc.).
  • varName: String. Variable name (with prefix "concat_adm1_").
  • tabId: Optional String. Spatial table identifier.

Returns: Long. Population count at the given rank.


TopHF #

Return the top health facility name for a spatial variable.

Signature:

Public Function TopHF(ByVal adminOrder As Integer, _
                      ByVal varName As String, _
                      Optional ByVal tabId As String = vbNullString) As String

Parameters:

  • adminOrder: Integer. Rank order (1 = top, 2 = second, etc.).
  • varName: String. Variable name (with "hf_" prefix).
  • tabId: Optional String. Spatial table identifier.

Returns: String. Health facility name at the given rank.


Internal members (not exported)

Factory

Self #

Current object instance cast to the interface.

Signature:

Public Property Get Self() As IEventLinelist

Returns: IEventLinelist. The current instance.


Private — HList change handler

HandleHListChange #

Handle value changes on HList sheets.

Signature:

Private Sub HandleHListChange(ByRef sh As Worksheet, ByRef target As Range, _
                              ByRef shHn As IHiddenNames)

Dispatches based on the target cell's position relative to the table: geo cascades (geo1-geo4 controls), editable labels (label row), list_auto flagging, go-to-section navigation, header protection (header row), and multiple choice updates.

Parameters:


Private — VList change handler

HandleVListChange #

Handle value changes on VList sheets.

Signature:

Private Sub HandleVListChange(ByRef sh As Worksheet, ByRef target As Range, _
                              ByRef shHn As IHiddenNames)

Handles editable label updates, multiple choice updates, and go-to-section navigation on vertical list sheets.

Parameters:


Private — Analysis change handler

HandleAnalysisChange #

Handle value changes on analysis sheets.

Signature:

Private Sub HandleAnalysisChange(ByRef sh As Worksheet, _
                                  ByRef target As Range, _
                                  ByRef analysisType As String)

Processes go-to-section navigation for all analysis types. For spatial analysis sheets, dispatches to local spatial table update methods (UpdateSingleSpTable, DevideByPopulation, FormatDevidePop) based on named range patterns.

Parameters:


Private — Spatial table update handlers

UpdateSingleSpTable #

Update formulas in a single spatial table when user changes admin level.

Signature:

Private Sub UpdateSingleSpTable(ByVal rngName As String)

Replaces the admin reference in all formulas within the table's outer values range. Uses cached geo/passwords instances instead of creating new ones. Busy state is managed by the calling LinelistEventsManager.

Parameters:


DevideByPopulation #

Divide or revert all computed values by the population.

Signature:

Private Sub DevideByPopulation(ByVal rngName As String, _
                               Optional ByVal revertBack As Boolean = False)

Iterates through the outer values range of a spatial table and modifies formulas to include or remove population division. Uses cached geo/spatial/passwords instances.

Parameters:


FormatDevidePop #

Toggle population division formatting.

Signature:

Private Sub FormatDevidePop(ByVal rngName As String)

Shows or hides the population factor cell and label based on the divide/no-divide dropdown selection, then delegates to DevideByPopulation to apply or remove the formula modifications.

Parameters:


Private — Selection change handler

HandleSelectionHList #

Handle selection changes on HList sheets.

Signature:

Private Sub HandleSelectionHList(ByRef sh As Worksheet, ByRef target As Range, _
                                ByRef shHn As IHiddenNames)

Updates geo dropdown validation lists when the user navigates to a geo2, geo3, or geo4 cell.

Parameters:


Private — List auto helpers

UpdateListAutoSheet #

Update the list-auto dropdowns for a single sheet.

Signature:

Private Sub UpdateListAutoSheet(ByRef sh As Worksheet)

Checks the has_listauto flag to skip sheets without list-auto variables. Iterates header columns and updates dropdown lists from unique data values.

Parameters:


Private — Multiple choice helper

UpdateMultipleChoice #

Handle multiple choice dropdown value toggling.

Signature:

Private Sub UpdateMultipleChoice(ByRef target As Range, ByRef choiSep As String)

Parameters:


Private — Unique values helper

GetUniqueBA #

Return unique values from a BetterArray.

Signature:

Private Function GetUniqueBA(ByRef inputTable As BetterArray, _
                             Optional ByVal Sort As Boolean = False) As BetterArray

Parameters:

Returns: BetterArray. Array of unique values.


Private — Sheet metadata helpers

SheetTag #

Get the sheet type tag from worksheet-level HiddenNames.

Signature:

Private Function SheetTag(ByRef sh As Worksheet) As String

Parameters:

Returns: String. The sheet type tag (HList, VList, Uni-Bi-Analysis, etc.).


Private — Lazy initialisation

EnsureTranslation #

Lazily initialise translation, message translator, and hidden names.

Signature:

Private Sub EnsureTranslation()

EnsureDropdown #

Lazily initialise the dropdown manager.

Signature:

Private Sub EnsureDropdown()

EnsureGeo #

Lazily initialise the geo helper.

Signature:

Private Sub EnsureGeo()

EnsureSpatial #

Lazily initialise the spatial helper.

Signature:

Private Sub EnsureSpatial()

EnsurePasswords #

Lazily initialise the password manager.

Signature:

Private Sub EnsurePasswords()

EnsureDictionary #

Lazily initialise the dictionary and variables helpers.

Signature:

Private Sub EnsureDictionary()

EnsureVariables #

Lazily initialise the variables helper from the cached dictionary.

Signature:

Private Sub EnsureVariables()

SheetOrNothing #

Retrieve a worksheet from the host workbook or Nothing.

Signature:

Private Function SheetOrNothing(ByRef sheetName As String) As Worksheet

Parameters:

Returns: Worksheet. The worksheet, or Nothing when not found.


Private — Cache management

ResetInternalCaches #

Clear all lazily-cached domain managers.

Signature:

Private Sub ResetInternalCaches()

Private — Error handling

ThrowError #

Raise a ProjectError-based exception.

Signature:

Private Sub ThrowError(ByVal errNumber As Long, ByRef message As String)

Parameters:


Used in (5 file(s))