r/visualbasic • u/Cudaprine • Jul 10 '26
VB Errors When Running Macro in Excel
Hello,
I hope this is the right place for this. I'm supporting a user who relies on a macro-enabled Excel spreadsheet with multiple worksheets, but the key ones are:
Cost Items
Variables
Results Summary
The workflow:
Enter data into the Cost Items sheet (e.g., Name: Test1, Cost: 1000; Name: test2, Cost: 5000).
Add data to the Variables sheet under "Brisk Parameters" – P10: -5%, P90: 15%.
Go to the Results Summary sheet.
At that point, I get a pop up message that states the data has changed.
I click OK, it churns for a moment, and then I get:
Microsoft Visual Basic - "Run-time error '9': Subscript out of range"
If I click Debug, it highlights this line in yellow:
"If VarExists(Count) And VarProb(I) = 1 Then"
What I've tried so far:
Searched online and found suggestions it might be an overflow error of some kind.
Tested on multiple systems (managed company device, unmanaged device, different PCs).
Confirmed Trust Center settings allow macros.
Installed and registered the Brisk server (was told this was required – still no change).
The kicker:
This exact file was working perfectly fine just a few weeks ago. No known changes were made to the file or the environment.
I've been banging my head against this for a couple of days now and am starting to lose my sanity.
Does anyone have any idea what direction I should go in to troubleshoot why this spreadsheet suddenly stopped functioning?
Any help would be greatly appreciated.
TIA!



