Risk Assessment & Management Flashcards
7 cards from real Excel VBA practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Risk Assessment & Management flashcards as text
A VBA risk tool must prevent users from saving the workbook unless all mandatory risk fields are populated. Which event should enforce this validation?
Answer: Workbook_BeforeSave
Workbook_BeforeSave fires before every save attempt, allowing VBA to validate fields and cancel the save by setting Cancel = True if requirements are not met.
In a VBA-based Value-at-Risk (VaR) calculation, the Percentile worksheet function is accessed via WorksheetFunction. If the returns array contains errors, the safest approach is to:
Answer: Pre-filter the array to remove error values before calling Percentile
Filtering out error values before calling Percentile ensures the function receives clean numeric data, preventing a VBA runtime error that On Error Resume Next would silently swallow.
A risk macro loops through 500 portfolio positions and updates a progress bar label on a UserForm. Calling DoEvents every iteration causes noticeable slowdown. The best compromise is to:
Answer: Call DoEvents every 50 iterations using Mod
Updating the UI and yielding to Windows every 50 iterations (i Mod 50 = 0) reduces DoEvents overhead while keeping the interface reasonably responsive.
Which technique allows a VBA risk model to send an automated email alert when calculated exposure exceeds a defined limit, using only built-in Office components?
Answer: Create an Outlook.Application object via late binding and send via its MailItem
Creating an Outlook.Application COM object and configuring a MailItem gives full control over recipients, subject, and body without external tools.
A risk register macro accidentally deletes rows instead of hiding them. To add an undo checkpoint before the destructive operation, a developer should call:
Answer: Application.OnUndo
Application.OnUndo registers a custom procedure with the Undo stack so the user can reverse the macro's destructive action.
When a VBA simulation produces a risk score distribution, which WorksheetFunction call returns the value below which 95% of simulated scores fall?
Answer: WorksheetFunction.Percentile(arr, 0.95)
WorksheetFunction.Percentile with k=0.95 returns the 95th percentile, which is the value below which 95% of the simulated outcomes fall.
A compliance-sensitive risk workbook must log every macro execution with a timestamp to an audit trail sheet. To ensure the log is written even if the macro errors out, the logging call should be placed in:
Answer: Both the main flow and the error handler's Exit Sub path
Placing the audit log write in both the normal exit path and the error handler guarantees a record is created regardless of whether the macro succeeded or failed.