Search notes:

Excel VBA example: waterfall chart

option explicit

sub main() ' {

    dim rngData as range
    set rngData = range( cells(1,1), cells(9,1) )
    rngData.value = worksheetFunction.transpose(array("Data", 2.1 , 3.8 , 2.9 , -1.4 , -2.0 , 1.1 , 2.8, -0.4 ))

  '
  ' Apparently, a waterfall chart does not allow to set the
  ' initial source range with .setSourceData, it seems that
  ' the source data needs to be selected when the chart is
  ' created:
  '
    rngData.select

    dim shp as shape
    set shp = activeSheet.shapes.addChart2(395, xlWaterfall)

    dim cht   as  chart
    set cht = shp.chart

    with cht ' {

      .hasTitle        =  true
      .chartTitle.text = "Simple Waterfall Chart"

      .export                                                    _
         fileName   :=  activeWorkbook.path & "\img\simple.png", _
         filterName := "png"

    end with ' }

end sub ' }
Github repository about-MS-Office-object-model, path: /Excel/Chart/types/waterfall/simple.bas

See also

Waterfall charts are somewhat related to this chart that displays from-to ranges.
Creating a waterfall like chart with error bars.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1759517784, '216.73.216.149', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/Office/Excel/Object-Model/Chart/types/waterfall/index(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78