title: Using the OpenXmlSDK, how can I select/update the value in a cell that is a range-control?
body: <p>I'm not even sure if I'm using the correct terminology; I will update the question and title as required.</p>
  
  <p>I'm using the OpenXmlSDK to populate a pre-existing Excel 2010 <code>.xlsm</code> file - a macro-enabled worksheet.</p>
  
  <p>I can access worksheets and cells fairly well.</p>
  
  <p>However, I can't figure out how to either access or update the data in a cell that is a dropdown-control that takes its values from a range on another worksheet.</p>
  
  <p>It's labelled as "H13" on the worksheet, and right-click >> format control shows</p>
  
  <pre><code>Input range: 'anotherWorksheet'!$N$3:$N$54
  Cell link: 'anotherWorksheet'!$M$3
  </code></pre>
  
  <p>Whenever I try to get a reference to this cell, I can't find it -- I get a <code>null</code> value</p>
  
  <p>I've tried two access methods:</p>
  
  <p>I'm not even sure if I'm using the correct terminology; I will update the question and title as required.</p>
  
  <p>I'm using the OpenXmlSDK to populate a pre-existing Excel 2010 <code>.xlsm</code> file - a macro-enabled worksheet.</p>
  
  <p>I can access worksheets and cells fairly well.</p>
  
  <p>However, I can't figure out how to either access or update the data in a cell that is a dropdown-control that takes its values from a range on another worksheet.</p>
  
  <p>It's labelled as "H13" on the worksheet, and right-click >> format control shows</p>
  
  <pre><code>Input range: 'anotherWorksheet'!$N$3:$N$54
  Cell link: 'anotherWorksheet'!$M$3
  </code></pre>
  
  <p>Whenever I try to get a reference to this cell, I can't find it -- I get a <code>null</code> value</p>
  
  <p>I've tried two access methods:</p>
  
  <pre><code>    // http://msdn.microsoft.com/en-us/library/ff921204.aspx
      private static Cell GetCell(Worksheet worksheet, string addressName)
      {
          return worksheet.Descendants&lt;Cell&gt;().Where(
            c =&gt; c.CellReference == addressName).FirstOrDefault();
      }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>    // Given a worksheet, a column name, and a row index,
      // gets the cell at the specified column and
      // http://stackoverflow.com/questions/527028/open-xml-sdk-2-0-how-to-update-a-cell-in-a-spreadsheet
      private static Cell GetCell(Worksheet worksheet, string columnName, uint rowIndex)
      {
          Row row = GetRow(worksheet, rowIndex);
  
          if (row == null)
              return null;
  
          return row.Elements&lt;Cell&gt;().Where(c =&gt; string.Compare
                 (c.CellReference.Value, columnName +
                 rowIndex, true) == 0).FirstOrDefault();
      }
  
      // Given a worksheet and a row index, return the row.
      private static Row GetRow(Worksheet worksheet, uint rowIndex)
      {
          return worksheet.GetFirstChild&lt;SheetData&gt;().
            Elements&lt;Row&gt;().Where(r =&gt; r.RowIndex == rowIndex).First();
      }
  </code></pre>
  
  <p>Both yield <code>null</code> for the target cell <code>H13</code>, but provide references to surrounding cells (ie, `H12, H14, G13'</p>
  
  <p>Actually, <code>I13</code> also yields <code>null</code>, but that cell is not populated with anything. However, if I can't get a reference, how could I populate it with the SDK? Not my main point, here.</p>
  
  <p>I will be receiving data that will match one of the entries in the dropdown; I just need to actually populate/select that particular entry in the target spreadsheet.</p>
  
  <p>How can I do this with the OpenXmlSDK? I've tried using various open-source libraries, but none seem to support <code>.xslm</code> files (file provided by the client, and cannot be used in another format; macros must execute on launch, etc.).</p>
  
  <p>Although I'm using C#, since my question is about the OpenXmlSDK, I would accept answers in other languages using that framework.</p>