title: How to set Excel column widths to a certain number of pixels?
body: <p>I have the following data set on a worksheet:</p>
  
  <pre><code>SheetName|ColumnIndex|Pixels
  ---------+-----------+------
  abc      |1          |50
  abc      |2          |150
  def      |1          |125
  </code></pre>
  
  <p>For each sheet, I'd like to set the column width to the appropriate number of pixels, using something like:</p>
  
  <pre><code>Sub setColumn (sheetName As string, columnIndex As long, pixels As long)
      width=getWidthInCharacters(pixels)
      ThisWorkbook.Sheets(sheetName).Cells(1, columnIndex).EntireColumn.ColumnWidth = width
  End Sub
  </code></pre>
  
  <p>I haven't been able to figure out how to write the <code>getWidthInCharacters()</code> function.  How do I convert pixels to characters, or possibly set <code>.ColumnWidth</code> to pixels directly?</p>