title: Finding the number of non-blank columns in an Excel sheet using VBA
body: <p>How do I find the number of used columns in an Excel sheet using VBA?</p>
  
  <pre><code>Dim lastRow As Long
  lastRow = Sheet1.Range("A" &amp; Rows.Count).End(xlUp).Row
  MsgBox lastRow
  </code></pre>
  
  <p>Using the above VBA I'm able to find the number of rows. But how do I find the number of columns in my given excel file? </p>