Select Range: Object reference not set to an instance of an object

Hi, I’m trying to select a range “L2:N”+(DT.Rows.Count+1).ToString in Excel. The workbook is correct and the datatable variable DT is correctly assigned. But when I run the process, it gives me this error: Object reference not set to an instance of an object. Can someone help me with this issue?

Hi,

Can you share your workflow? It seems DT might be null.

Regards,

image
Hi, the DT should be no issue i think as i manage to print out the datatable in DT in the Excel and the content is correct.


As highlighted in the picture above, I am trying to select the range from L2 to M+last row of the table but it fails.
image

HI,

Thank you for sharing your screenshots.
To isolate causes, can you try the following step?

  1. Put the below assign activity just before Select Range

    strRange = “L2:N”+ (DT.Rows.Count+1).TOString

  2. Set strRange at Range property of Select Range.

  3. Run debug mode. Workflow will stop if exception occures, then check content of strAddress etc at Local panel.

Regards,

Hi,

I have successfully resolved my problem. Thank you very much. :slight_smile:

1 Like