79673473

Date: 2025-06-20 13:43:55
Score: 2.5
Natty:
Report link

I tried making a few changes to the code and added in a few debugging triggers. I think I at least narrowed down where the issue is.

// wrap the string in double-quotes, so it will work with the Indirect function
object refCellObj = Excel(xlfIndirect, $"\"{strCell}\"");  strDebug = $"\"{strCell}\"";

strDebug = ""; 

// DIAGNOSTIC LOGGING

strDebug = $"[DEBUG] INDIRECT({strCell}) → {refCellObj?.GetType().Name}";

For the case where strCell = D27 (same sheet), everything works fine.

For the case where strCell = Sheet2!D27, the value of refCellObj = ExcelError, becuase xlfIndirect appears to be choking on strCell.

Any idea how I should format the string (strCell) that gets fed into the xlfIndirect function?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: justhumm