title: Rounding up to nearest higher integer in VBA
body: <p>I'm trying to calculate how many layers a commodity will be stacked in. I have a variable quantity (<code>iQty</code>), a given width for the loadbed (<code>dRTW</code>), a width per unit for the commodity (<code>dWidth</code>) and a quantity per layer (<code>iLayerQty</code>).</p>
  
  <p>The quantity per layer is calculated as <code>iLayerQty = Int(dRTW/dWidth)</code></p>
  
  <p>Now I need to divide the total quantity by the quantity per layer and round up. In an Excel formula it would be easy, but I'm trying to avoid WorksheetFunction calls to minimise A1/R1C1 confusion. At the moment I'm approximating it with this:</p>
  
  <pre><code>(Number of layers) = ((Int(iQty / iLayerQty) + 1)
  </code></pre>
  
  <p>And that works fine <em>most</em> of the time - except when the numbers give an integer (a cargo width of 0.5 m, for instance, fitting onto a 2.5 m rolltrailer). In those instances, of course, adding the one ruins the result.</p>
  
  <p>Is there any handy way of tweaking that formula to get a better upward rounding?</p>