title: Formatting databar object
body: <p>I am trying to write a VBA script that adds in a <code>databar</code> conditional formatting for a range.  I have written the code below, however, I don't know how to change the color of the <code>databar</code>, and provide different bounds on it.  </p>
  
  <p>Oddly enough, when I set the <code>minpoint</code> to 0, it works, but I am unable to set the <code>maxpoint</code> to a named variable (set to type <code>integer</code>).  Where am I going wrong?</p>
  
  <pre><code>Set bar = rangeTest.FormatConditions.AddDatabar
  
  'assign max value + 1 for databar upper bound
  maxValue = Application.WorksheetFunction.Max(rangeTest) + 1
  
  With bar
      .BarFillType = xlDataBarFillSolid
      .BarColor = RGB(189, 215, 238) 'error thrown here (Object doesn't support this property)
  End With
  
  With rangeTest.FormatConditions(1)
      .MinPoint.Modify newtype:=0  'xlConditionValueAutomaticMin
      .MaxPoint.Modify newtype:=xlConditionValueAutomaticMax 'error thrown here (invalid procedure call)
  End With
  </code></pre>