title: How to convert Object from UDF parameter to Excel Range in Excel-DNA?
body: <p>I am developing a simple Addin using Excel-DNA. I have written a below function, but I am finding difficulties in converting it to a Range object. Tried googling and not able to figure out. Can someone please help me</p>
  
  <pre><code>[ExcelFunction(Description = "Excel Range")]
  public static string Concat2([ExcelArgument(AllowReference = true)] object rng)
  {
      try
      {
         // Assuming i am calling this from Excel cell A5 as =Concat2(A1:A2)
          var app = (Excel.Application)ExcelDnaUtil.Application;
          var r = app.Range[rng, Type.Missing];
  
          return r.Cells[1,1] + r.Cells[2,2]
      }
  
      catch (Exception e)
      {
          return "Error";
      }
  }
  </code></pre>