title: Programmatically getting the maximum allowed number of columns and rows of a Sheet
body: <p>In a sick Excel (I use Office 10) VBA macro, <strong>i need to trap the case where the user managed to create a sheet with the maximum number of columns or rows by accident</strong>.</p>
  
  <p>I don´t remember how that happens, nor would I care; but most of us have seen Excel sheets that had an active sheet size of 16384 cells in width and/or 1048576 cells in height -- even though there were only a handful of nonempty cells on the sheet.</p>
  
  <p>I simply want to detect this situation in VBA code.</p>
  
  <p>A sheet´s <code>Rows.Count</code> and <code>Columns.Count</code> of course return the figures, and I could check if they equal <code>16384</code> or <code>1048576</code>, respectively.</p>
  
  <p>However, those limits are version-dependent. </p>
  
  <p>So my question is:</p>
  
  <p><strong>How can I get the maximum limit for the number of rows and columns in a given Excel worksheet in VBA without coding version-dependent if-statements?</strong> There might be a constant for each limit value, but I yet failed to find it.</p>
  
  <p>Note I am not looking for the size of <code>Worksheet.UsedRange</code>. I want to determine if <code>UsedRange</code> has been extended to the whole available "sheetspace", which usually happens only by accident, but -- it happens, and I want to detect that situations.</p>
  
  <p>I am also not looking for the limits per Excel version. (This is easily googleable.) I don´t want to hardcode those values and version numbers.</p>