title: VBA Case Select Multiple Conditions
body: <p>New to VBA.  I'm attempting to build a value of Dimensions (pulling from two different cells in an excel spreadsheet in which one might be larger than the other, and I always want the lower number first) in which the output (a string which will be concatenated with strings from other functions) might be one of the following:</p>
  
  <p>4868 (no x separating the integer values)
  48x60.5 (with x separating an integer and real number)
  36.5x60 (with x separating a real number and an integer)
  24.75x72.125 (with x separating a real number and an integer)</p>
  
  <p>Variable types are defined in VBA as Single (not Double).  Here's my code:</p>
  
  <pre><code>Function getDimDisplay(h As Single, w As Single) As String
  
  Dim strResult As String
  Dim iH As Integer
  Dim iW As Integer
  Dim strH As Variant
  Dim strW As Variant
  
  iH = CInt(h)
  iW = CInt(w)
  
  Select Case h
      Case (h &gt;= w And iH = h And iW = w)
          strH = CStr(iH)
          strW = CStr(iW)
          strResult = strW &amp; strH
      Case (h &gt;= w And iH &lt;&gt; h And iW = w)
          strH = CStr(h)
          strW = CStr(iW)
          strResult = strW &amp; "x" &amp; strH
      Case (w &gt;= h And iH = h And iW &lt;&gt; w)
          strH = CStr(iH)
          strW = CStr(w)
          strResult = strH &amp; "x" &amp; strW
      Case (w &gt;= h And iH &lt;&gt; h And iW &lt;&gt; w)
          strH = CStr(h)
          strW = CStr(w)
          strResult = strH &amp; "x" &amp; strW
  End Select
  
  getDimDisplay = strResult
  
  End Function
  </code></pre>
  
  <p>It will compile, but it won't return any output.  What gives?</p>