IProgressBar
Defines the public contract for the ProgressBar class, exposing a cell-based visual progress indicator on a worksheet. Supports configurable colours, number formatting, status messages, and step-based or absolute value updates.
Configuration
Attach #
Bind the progress bar to a worksheet range
Signature:
Public Sub Attach(ByVal barRange As Range, Optional ByVal maximum As Long = 100)
Bind the bar to a range and configure visual properties. The range must be a contiguous area whose cells will be tinted to reflect progress.
Parameters:
barRange: Range. Hosting the visual progress indicator.maximum: Long. Maximum expected value. Defaults to 100.
ConfigureColors #
Configure the colours for completed and remaining segments
Signature:
Public Sub ConfigureColors(ByVal completedColor As Long, ByVal pendingColor As Long)
Parameters:
completedColor: Long. Colour applied to completed cells.pendingColor: Long. Colour applied to remaining cells.
ConfigureValueFormat #
Configure the number format for progress text
Signature:
Public Sub ConfigureValueFormat(ByVal formatPattern As String)
Parameters:
formatPattern: String. VBA format pattern.
AttachStatusCell #
Bind a cell for textual status messages
Signature:
Public Sub AttachStatusCell(ByVal statusRange As Range)
Parameters:
statusRange: Range. Single-cell range receiving status messages.
Progress
Update #
Update the current value and re-render the bar
Signature:
Public Sub Update(ByVal currentValue As Long, Optional ByVal statusMessage As String = vbNullString)
Update, step, complete, and reset the progress value.
Parameters:
currentValue: Long. Absolute progress value.statusMessage: String. Message pushed to the status cell. Defaults to vbNullString.
StepBy #
Increment the current value by a step
Signature:
Public Sub StepBy(Optional ByVal stepValue As Long = 1, Optional ByVal statusMessage As String = vbNullString)
Parameters:
stepValue: Long. Increment. Defaults to 1.statusMessage: String. Message pushed to the status cell. Defaults to vbNullString.
Complete #
Mark the progress as complete
Signature:
Public Sub Complete(Optional ByVal statusMessage As String = vbNullString)
Parameters:
statusMessage: String. Message pushed to the status cell. Defaults to vbNullString.
Reset #
Reset the current value to zero and clear the bar
Signature:
Public Sub Reset(Optional ByVal statusMessage As String = vbNullString)
Parameters:
statusMessage: String. Message pushed to the status cell. Defaults to vbNullString.
Properties
BarRange #
Range hosting the progress bar
Signature:
Public Property Get BarRange() As Range
Read-only and read-write state accessors.
Returns: Range. The bar range.
StatusCell #
Status cell receiving text messages
Signature:
Public Property Get StatusCell() As Range
Returns: Range. The status cell, or Nothing.
Maximum #
Maximum expected value
Signature:
Public Property Get Maximum() As Long
Returns: Long. The maximum value.
Maximum #
Update the maximum expected value
Signature:
Public Property Let Maximum(ByVal value As Long)
Parameters:
value: Long. New maximum (must be greater than zero).
Value #
Current progress value
Signature:
Public Property Get Value() As Long
Returns: Long. The current value.
PercentComplete #
Compute the current completion percentage
Signature:
Public Property Get PercentComplete() As Double
Returns: Double. Ratio between 0 and 1.