Hello Jonathan,
If the range has not precedents, it will throw an exception when accessing this property. Here, it is right way to use try/catch block. Code like this:
try
{
foreach (Excel.Range r in range.Precedents)
{
......
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
If you have any further question, please feel free to let us know.
Best regards,
Bessie
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.