rows.com

Clickable symbols transform your spreadsheet into an interactive data tool

If you're working on an Excel character sheet and want to create interactive proficiency indicators, you might find yourself grappling with merged cells and VBA code.

3 min readMicrosoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

There is a better way to handle merged cells, and this reader's experience proves why. The VBA code is thoughtful, it uses a static busy flag, disables events, and resolves the merged range to its top-left cell, yet it still fails intermittently. That failure is not a bug in the logic; it is a structural problem with how Excel's event model interacts with merged ranges. When you click a merged cell, the `Target` object can refer to the entire merged area, but `SelectionChange` fires before Excel fully resolves the selection. Writing to an adjacent cell while events are disabled sometimes triggers a recalculation or a range shift that Excel cannot reconcile, especially when the merged area spans multiple rows or columns. The result is the "Application-defined or object-defined error" that appears at random.

The practical fix is to decouple the write action from the selection event entirely. Instead of writing to the cell to the right inside `Worksheet_SelectionChange`, store the new symbol and the multiplier in module-level variables, then write them in `Worksheet_Calculate` or in a deferred timer callback. This separates the user interaction from the cell update, giving Excel a full event cycle to stabilize the selection. Another pattern is to use `Worksheet_Change` instead of `SelectionChange`, but that requires a different trigger, like a double-click or a button, because `Change` does not fire on selection alone. For a clickable toggle, the safest approach is to validate the target cell's address *after* the selection is fully resolved, using `Application.OnTime` to schedule a micro-delay of 0 seconds. That allows Excel to finish its internal merge handling before your code touches any adjacent cell.

This reader is building something genuinely useful: a character sheet that turns static cells into interactive controls. Merged cells are a layout necessity in many custom spreadsheets, but Excel treats them as second-class citizens in event code. The lesson is not to abandon merged cells, but to treat them as a signal that the event model needs an extra layer of indirection. If you are building similar interactive tools, adopt a "write later" pattern from the start. Your formulas will calculate correctly, your users will click without error, and you will stop chasing phantom bugs that only appear when the moon is full and the selection is merged.

From Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

I am building an Excel character sheet where certain cells act as clickable proficiency indicators.

Each indicator cell (often merged across multiple columns/rows for layout) should cycle through symbols when clicked:

Read the original at Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community