title: how to set excel cell format in vb.net
body: <p>I'm modifying an existing application written in vb.net. 
  There is an export option which exports information to an excel sheet.
  Before exporting the cell format is defined as follows. </p>
  
  <pre><code>.Cells(cRow, 17).NumberFormat = "$#,##0.00_);($#,##0.00)"
  </code></pre>
  
  <p>this works fine. But according to the new requirement, currency symbol is dynamic.
  Therefore once I set the currency (eg : Malaysian riggit -MYR),</p>
  
  <pre><code>.Cells(cRow, 17).NumberFormat = "MYR#,##0.00_);(MYR#,##0.00)"
  </code></pre>
  
  <p>this gives an error "<strong>Unable to set the NumberFormat property of the Range class</strong>".
  there can be many currencies and I tried setting the currency using a variable.</p>
  
  <pre><code>Dim strCurrency As String = ""
  strCurrency = "SGD"
  .Cells(cRow, 17).NumberFormat = ""+strCurrency +"#,##0.00_);("+strCurrency +"#,##0.00)"
  </code></pre>
  
  <p>All are giving me the same error.
  Someone please let me know how to set the custom currency symbol.
  thanks</p>