<?xml version="1.0" encoding="utf-8"?> 
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom">

    <channel>
    
    <title>Excel Blog</title>
    <link>http://www.cellmatrix.net/index.php/site/index/</link>
    <description>Formulas, Charts, and Models Created with Microsoft Excel.</description>
    <dc:language>en</dc:language>
    <dc:creator>jfm</dc:creator>
    <dc:rights>Copyright 2010</dc:rights>
    <dc:date>2010-05-15T10:51:47+00:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    <atom:link href="http://www.cellmatrix.net/index.php/site/rss_2.0/" rel="self" type="application/rss+xml" />
    

    <item>
      <title>Numbering Charts in a Worksheet Grid</title>
      <link>http://www.cellmatrix.net/index.php/site/numbering_charts_in_a_worksheet_grid/</link>
      <guid>http://www.cellmatrix.net/index.php/site/numbering_charts_in_a_worksheet_grid/</guid>
      <description>
            <![CDATA[<p>Many of the models I work with require a series of embedded charts to appear on a single worksheet.  Each chart is usually numbered for reference.  The numbers usually appear in a worksheet cell directly above the right-side of each embedded chart.</p>

<p>Below is a macro that will quickly add a number for each embedded chart to a cell on the upper right-side of the chart:</p>

<pre>
Sub NumberCharts()

    Dim i As Integer
    Dim Rng As Range
    Dim ColumnsAcross As Integer
    Dim RowsDown As Integer

    '*************************************************

    'The range where you want the first "Chart 1" to appear

    Set Rng = ActiveSheet.Range("F3")

    '# of columns to the right that you want "Chart 2" to appear

    ColumnsAcross = 5

    '# of rows down that you want "Chart 3" to appear

    RowsDown = 13

    '*************************************************

    i = 0

    Do Until i = ActiveSheet.ChartObjects.Count

        i = i + 1

        Rng.Value = "Chart " &amp; i
        Rng.HorizontalAlignment = xlRight

        i = i + 1

        Rng.Offset(0, ColumnsAcross).Value = "Chart " &amp; i
        Rng.Offset(0, ColumnsAcross).HorizontalAlignment = xlRight

        Set Rng = Rng.Offset(RowsDown, 0)

    Loop

End Sub
</pre>

<p>The numbers appear on the upper right-side of the chart similar to below:</p>

<div class = "ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010051501.gif" style="border: 0;" alt="image" width="662" height="493" />
</div>

<br/>


            <hr /> 
            <p>Posted on: May 15, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/Charts/">Charts</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/numbering_charts_in_a_worksheet_grid/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>Charts</dc:subject>
      <dc:date>2010-05-15T10:51:47+00:00</dc:date>
    </item>

    <item>
      <title>Get a Maximum and Minimum Value from Certain Charts</title>
      <link>http://www.cellmatrix.net/index.php/site/get_a_maximum_and_minimum_value_from_certain_charts/</link>
      <guid>http://www.cellmatrix.net/index.php/site/get_a_maximum_and_minimum_value_from_certain_charts/</guid>
      <description>
            <![CDATA[<p>A utility that I use at work automatically sets the Y Axis of an embedded chart to a calculated minimum and maximum value.  To do so, the utility must extract the maximum and minimum point values from that chart.  As I'm in the process of updating this utility to work with the Excel 2007 ribbon, I thought it would be good to document the VBA procedure that I used to extract the minimum and maximum values:</p>      

<pre>
Sub Max_Min_Chart_Point_Values()

    Dim Cht As Chart
    Dim Srs As Series

    Set Cht = ActiveChart
    Set Srs = Cht.SeriesCollection(1)

    MaxVal = Srs.Values(1)
    MinVal = Srs.Values(1)

    For m = 1 To ActiveChart.SeriesCollection.Count
        A = ActiveChart.SeriesCollection(m).Values
        For l = 1 To ActiveChart.SeriesCollection(m).Points.Count
            If A(l) &#62; MaxVal Then MaxVal = A(l)
            If A(l) &#60; MinVal Then MinVal = A(l)
        Next l
    Next m
    
    Debug.Print MaxVal
    Debug.Print MinVal

End Sub
</pre>

<p>Please note that I've not tested this procedure with every chart type.  I do know that it works with line and column charts, which happen to be most of the charts that I work with.</p>

<br />

            <hr /> 
            <p>Posted on: March 25, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/Charts/">Charts</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/get_a_maximum_and_minimum_value_from_certain_charts/">Comments:</a> (13)</p> 
            ]]>
      </description>
      <dc:subject>Charts</dc:subject>
      <dc:date>2010-03-25T12:00:08+00:00</dc:date>
    </item>

    <item>
      <title>Simple Rollover Calculation</title>
      <link>http://www.cellmatrix.net/index.php/site/simple_rollover_calculation/</link>
      <guid>http://www.cellmatrix.net/index.php/site/simple_rollover_calculation/</guid>
      <description>
            <![CDATA[<p>In healthcare, the term "rollover" can refer to the amount of volume it would take to offset a change in revenue.  A typical question might be "if we sign a contract with a certain insurance company and they agree to a 30% discount, how much more additional volume will we need to see to offset that discount?"  The term "volume" refers to billed charges for office visits, surgery procedures, pharmacy prescriptions, etc.</p>

<p>For example, if we currently have $600,000 in patient charges, a bad debt rate of 5%, and 7,500 units of volume, how much more volume do we need to see if the discount rate goes from 5% to 30%?  In the screenshot below, the $600,000 of gross revenue appears in line 1, the 5% discount rate in line 2, and 7,500 units of volume in line 5.  The net revenue is calculated by multiplying the gross revenue by the discount rate.</p>

<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010032101.gif" style="border: 0;" alt="image" width="276" height="240" />
</div>

<p>The first step to estimating the rollover impact is to calculate the gross revenue per unit for the data you're given.  That calculation appears in line 6 below.  Next, carry the gross revenue per unit ($80), the net revenue ($570,000), and the new discount rate (30%) into the second column of calculations.</p>
 
<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010032102.gif" style="border: 0;" alt="image" width="357" height="276" />
</div>

<p>Calculate the gross revenue by dividing the net revenue by 1 - the discount rate.  The formula in cell F4 is:</p>

<pre>
=F8/(1-F10)
</pre>

<p>Finally, calculate the volume required at a 30% discount by dividing the gross revenue by the gross revenue per unit.  In the screenshot below, the formula in cell F12 is:</p>

<pre>
=F4/F14
</pre>

<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010032103.gif" style="border: 0;" alt="image" width="519" height="276" />
</div>

<p>In summary, the analysis shows that volume needs to increase 36% to recover the net revenue lost by increasing the discount rate from 5% to 30%.</p>

<br/>
            <hr /> 
            <p>Posted on: March 21, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/healthcare/">Healthcare</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/simple_rollover_calculation/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>Healthcare</dc:subject>
      <dc:date>2010-03-21T13:42:42+00:00</dc:date>
    </item>

    <item>
      <title>Add an ActiveX SpinButton Control to a Spreadsheet</title>
      <link>http://www.cellmatrix.net/index.php/site/add_an_activex_spinbutton_control_to_a_spreadsheet/</link>
      <guid>http://www.cellmatrix.net/index.php/site/add_an_activex_spinbutton_control_to_a_spreadsheet/</guid>
      <description>
            <![CDATA[<p>One of my favorite tools for controlling the input to a single cell within an interactive spreadsheet model is an ActiveX SpinButton.  When added to a spreadsheet, the SpinButton can allow the user to move quickly through multiple scenarios within a predefined range of values.</p>  

<p>In Excel 2007, you can add an ActiveX SpinButton to a spreadsheet by first selecting the Developer tab.  Then select Insert -> ActiveX Controls -> Spin Button.</p>

<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010220101.bmp" style="border: 0;" alt="image" width="633" height="379" />
</div>

<p>In Design mode, you can link a cell as well as adjust the minimum and maximum values for the SpinButton.  To do so, click on the SpinButton when in design mode.  Then right-click on your mouse to access the properies for that SpinButton.</p>

<p>Rather than manually entering the minimum, maximum, and linked cell properties, my personal preference is to use a few simple VBA statements.  For example, assuming the SpinButton is named "SpinButton1", to add a maximum value = 30, a minimum value = 20, and a linked cell = C4, and an incremental value = 1, add the following code to the sheet module for the sheet containing the ActiveX SpinButton.</p> 

<pre>
Private Sub SpinButton1_SpinDown()
    With Range("C4")
        .Value = WorksheetFunction.Max(20, .Value - 1)
    End With
End Sub

Private Sub SpinButton1_SpinUp()
    With Range("C4")
        .Value = WorksheetFunction.Min(30, .Value + 1)
    End With
End Sub
</pre>

<p>The cell entry for the SpinButton combined with the SpinButton Control might be set up on the spreadsheet to look like this:</p>

<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010220102.bmp" style="border: 0;" alt="image" width="322" height="125" />
</div>

<p>To allow the SpinButton to accept changes in percent, slightly modify the code above.  For example, to add a maximum value = .50, a minimum value = .30, and a linked cell = C4, and an incremental value = .01, add the following code to the sheet module for the sheet containing the ActiveX SpinButton.</p>

<pre>
Private Sub SpinButton1_SpinDown()
    With Range("C4")
        .Value = WorksheetFunction.Max(0.3, .Value - 0.01)
    End With
End Sub

Private Sub SpinButton1_SpinUp()
    With Range("C4")
        .Value = WorksheetFunction.Min(0.5, .Value + 0.01)
    End With
End Sub
</pre>

<p>After changing the cell entry number format to percent, for the SpinButton combined with the SpinButton Control might be set up on the spreadsheet to look like this:</p>

<div class="ctr">
<img src="http://www.cellmatrix.net/images/uploads/2010220103.bmp" style="border: 0;" alt="image" width="322" height="125" />
</div>

<p>Although you must be in design mode to modify the size and position of the SpinButton and /or modify its properties, you must exit the design mode in order for the SpinButton to be operable.</p>  

<p>Note: the examples above are based on code and techniques that can be found at the following:</p>
<ul>
<li>From java2s.com:  <a href="http://www.java2s.com/Code/VBA-Excel-Access-Word/Forms/Spinupeventprocedureforspinbutton.htm" title="SpinUp Events">SpinUp Events</a></li>
<li>From java2s.com:  <a href="http://www.java2s.com/Code/VBA-Excel-Access-Word/Forms/ThespinbuttoncontrolusestheSpinDownandSpinUpeventstodecreaseandincreasethevalueincellB4.htm" title="SpinDown Events">SpinDown Events</a></li>
<li>From Microsoft:  <a href="http://office.microsoft.com/en-us/excel/HP102366821033.aspx" title="Add a Scroll Bar or Spin Button to a Worksheet">Add a Scroll Bar or Spin Button to a Worksheet</a></li>
<li><a href="http://spreadsheetpage.com/index.php/book/excel_2007_power_programming_with_vba/" title="Excel 2007 Power Programming with VBA">Excel 2007 Power Programming with VBA</a> by John Walkenbach - Chapter 13 - Pages 440 - 442.</li>
<li>Excel 2000 VBA by John Green - Chapter 10 - page 175.</li>
</ul>

<br/>
            <hr /> 
            <p>Posted on: February 23, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/VBA/">VBA</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/add_an_activex_spinbutton_control_to_a_spreadsheet/">Comments:</a> (8)</p> 
            ]]>
      </description>
      <dc:subject>VBA</dc:subject>
      <dc:date>2010-02-23T12:30:55+00:00</dc:date>
    </item>

    <item>
      <title>Excel 2010 Chart Improvements &#45; Migrating Excel 4 Macros to VBA</title>
      <link>http://www.cellmatrix.net/index.php/site/excel_2010_chart_improvements_-_migrating_excel_4_macros_to_vba/</link>
      <guid>http://www.cellmatrix.net/index.php/site/excel_2010_chart_improvements_-_migrating_excel_4_macros_to_vba/</guid>
      <description>
            <![CDATA[<p>From the <a href="http://blogs.msdn.com/excel/archive/2010/02/16/migrating-excel-4-macros-to-vba.aspx" title="Microsoft Excel Product Team Blog">Microsoft Excel Product Team Blog</a> . . .</p> 

<p><i>There are a number of properties for chart elements that were previously only accessible through the Excel 4 Macro Language. We have added additional properties to VBA for these items.</i></p>

<p><b>Formula Properties</b> - <i>New properties replace the GET.FORMULA() XLM command, providing formula support for missing chart elements. New Formula properties (Formula, FormulaR1C1, FormulaLocal, FormulaR1C1Local) have been added for AxisTitle, ChartTitle, DisplayUnitLabel, and DataLabel objects.</i></p>

<p><b>Series/Point Name</b> - <i>The chart object model currently doesn’t provide a way to determine the series name that is given to a series when it is created. This information is available when hovering over a data point with the mouse, or using the SELECTION() function in XLM. The XLM command returns a point name in the format “SmPn” where m is the series number assigned when the chart is created and n is the point number. For example, when selecting a point on a chart, SELECTION() returns "S1P3". A new Point.Name property has been added that Returns a point name in the format “SmPn” where m is the series number assigned when the chart is created and n is the point number.</i></p> 

<p><b>Position Properties</b> - <i>The XLM Function GET.CHART.ITEM returns the X,Y coordinates of the corners or mid-points of any chart item. This function had been necessary for some chart elements that did not have positional (.Left, .Top, .Width, and .Height) properties. In Excel 2010 we added .Left, .Top, .Width, and .Height properties for any chart elements that did not have them. This included AxisTitle, ChartTitle, DisplayUnitLabel, Point, and DataLabel objects. Additionally we added a Point.PieSliceLocation Method that returns coordinates of multiple points on Pie Slices.</i></p>

<br/>

            <hr /> 
            <p>Posted on: February 19, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/Charts/">Charts</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/excel_2010_chart_improvements_-_migrating_excel_4_macros_to_vba/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>Charts</dc:subject>
      <dc:date>2010-02-19T11:56:12+00:00</dc:date>
    </item>

    <item>
      <title>RefEdit Entries</title>
      <link>http://www.cellmatrix.net/index.php/site/refedit_entries/</link>
      <guid>http://www.cellmatrix.net/index.php/site/refedit_entries/</guid>
      <description>
            <![CDATA[<p>Recently I've been working on creating a ribbon tab for Excel 2007 that interfaces with and controls several of the add-ins that I use for work.  The  
<a href="http://www.cellmatrix.net/index.php/excel/comments/goal_seek_tool/" title="Goal Seek Tool">Goal Seek Tool</a> is one of those add-ins.  I created this tool to allow the  entry of a single-cell range or value when performing the goal-seek function.</p>

<p>In November 2008 I wrote a short post about my Goal Seek tool.  In my first version of that tool, I used a RefEdit control to enter a range and a textbox to enter a value.  In a comment to that post, <a href="http://peltiertech.com/" title="Jon Peltier">Jon Peltier</a> noted that the textbox could be eliminated and the RefEdit control could be programmed to accept either a range or text entry.</p>

<p>After a lot of time searching the internet, I finally found an example of how this functionality could work on the <a href="http://www.tushar-mehta.com/" title="TM Consulting ">TM Consulting</a> site.  It looks like this:</p>

<p>When wanting to enter a range with RefEdit and assuming the RefEdit control is named "RefEdit1", use</p>

<pre>
Range(RefEdit1) 
</pre>  

<p>When wanting to enter a value with RefEdit, use</p>

<pre>
Range(RefEdit1).value 
</pre>  

<p>When wanting to validate the entries made into RefEdit, you can use examples like:</p>

<p>To validate that a range contains a formula, use</p>

<pre>
HasFormula(Range(RefEdit1)) 
</pre>  

<p>To validate that a range contains a number, use</p>

<pre>
IsNumeric(RefEdit1)
</pre>  

<br/>


            <hr /> 
            <p>Posted on: February 16, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/VBA/">VBA</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/refedit_entries/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>VBA</dc:subject>
      <dc:date>2010-02-16T11:47:32+00:00</dc:date>
    </item>

    <item>
      <title>VBA Fireworks Model from AJP Excel Information</title>
      <link>http://www.cellmatrix.net/index.php/site/vba_fireworks_model_from_ajp_excel_information/</link>
      <guid>http://www.cellmatrix.net/index.php/site/vba_fireworks_model_from_ajp_excel_information/</guid>
      <description>
            <![CDATA[<p>Recently I had the opportunity to build Andy Pope's <a href="http://www.andypope.info/fun/fireworks.htm" title="fireworks display">fireworks display</a> into a line chart that I produce each month.  Fireworks were requested because 2009 was the best year on record for a particular business unit at work.  When I presented the operating results the animation was a big hit.</p>  

<p>Once you download the file you'll find that Andy's display utilizes an XY Scatter chart and VBA code with trigonometry functions to produce the fireworks.  Because the code is unprotected you can easily load the modules into your own project and then customize the code as you wish.  Even if you don't have an interest in using the display, the file is worth downloading just to study how the model was developed.  Thanks Andy for making this available.</p>       
            <hr /> 
            <p>Posted on: January 28, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/VBA/">VBA</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/vba_fireworks_model_from_ajp_excel_information/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>VBA</dc:subject>
      <dc:date>2010-01-28T11:33:09+00:00</dc:date>
    </item>

    <item>
      <title>Turn off Automatic Hyperlinks</title>
      <link>http://www.cellmatrix.net/index.php/site/turn_off_automatic_hyperlinks/</link>
      <guid>http://www.cellmatrix.net/index.php/site/turn_off_automatic_hyperlinks/</guid>
      <description>
            <![CDATA[<p>Does it annoy you when Excel automatically turns an email or web address into a hyperlink when you want it entered as text?  In Excel 2007 you can prevent this from happening by clicking on the Office button and going to Excel Options -> Proofing -> Deselect the option titled "Ignore Internet and file addresses".</p>

<p>The <a href="http://spreadsheetpage.com/" title="The Spreadsheet Page">The Spreadsheet Page</a> has a tip titled <a href="http://spreadsheetpage.com/index.php/tip/removing_or_avoiding_automatic_hyperlinks/" title="Removing or Avoiding Automatic Hyperlinks">Removing or Avoiding Automatic Hyperlinks</a> that covers this very topic.  The tip provides the following macro which will allow you to instantly turn all of your hyperlinks into text.  The macro really helped me as I had a sheet with over 100 links to zap.</p>

<pre>
Sub ZapHyperlinks() 
    Cells.Hyperlinks.Delete
End Sub
</pre>

<p>As I'm just making the switch from Excel 2003 to 2007 it made me think . . . what features do Excel users automatically turn on or off when moving to a different version?  Understanding that everyone has their own preferences, I'd like to hear about those features that are a "must have" or that you immediately shut off.</p>  

<br/>


            <hr /> 
            <p>Posted on: January 17, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/General/">General</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/turn_off_automatic_hyperlinks/">Comments:</a> (3)</p> 
            ]]>
      </description>
      <dc:subject>General</dc:subject>
      <dc:date>2010-01-17T14:44:26+00:00</dc:date>
    </item>

    <item>
      <title>VBA Array to Change Line Chart Colors</title>
      <link>http://www.cellmatrix.net/index.php/site/vba_array_to_change_line_chart_colors/</link>
      <guid>http://www.cellmatrix.net/index.php/site/vba_array_to_change_line_chart_colors/</guid>
      <description>
            <![CDATA[<p>Part of my responsibilities at work is building the end-of-month financial packet that is presented to management.  That packet includes a variety of line charts that show trends in financial and statistical metrics.  Many of the graphs start with a base year and require adding an additional line as the year turns over.  For example, in 2009 and given a base year of 2006 each line chart would have five lines (2006, 2007, 2008, 2009 plan, and 2009 actual).  Now that the year has turned over, each graph will have six lines (2006, 2007, 2008, 2009, 2010 plan, and 2010 actual).</p>

<p>This may or may not be the most efficient process, but I prefer to keep the line series order as follows:</p>

<ul>
<li>Series 1 = Current Year (2010) -> line color = red</li>
<li>Series 2 = Current Year Plan (2010) -> line color = blue</li>
<li>Series 3 = Prior Year (2009) -> line color = green</li>
<li>Series 4 = Prior Year - 1 (2008) -> line color = silver</li>
<li>Series 5 = Prior Year - 2 (2007) -> line color = silver</li>
<li>Series 6 = Prior Year - 3 (2006) -> line color = silver</li>
</ul>  

<p>This logic can present a problem in that as an additional series is added, the series order needs to be renumbered and the line colors have to be redone.  To make the process easier, we use the following macro to change the series colors.  It uses an array to store the color index numbers for each series.</p>

<pre>
Sub Color_Series()

    Dim arrColors(1 To 6) As Integer
    
    Dim Cht As ChartObject
    
    Dim i As Integer
     
    arrColors(1) = 3    'Series 1 - Red = Current Year (2010)
    arrColors(2) = 5    'Series 2 - Blue = Current Year Plan (2010)
    arrColors(3) = 10  'Series 3 - Green = Prior Year (2009)
    arrColors(4) = 16  'Series 4 - Silver = Prior Year (2008)
    arrColors(5) = 15  'Series 5 - Silver = Prior Year (2007)
    arrColors(6) = 14  'Series 6 - Silver = Prior Year (2006)
    
    Set Cht = Worksheets("Sheet1").ChartObjects("Chart01")
    
    For i = LBound(arrColors) To UBound(arrColors)
    
        Cht.Chart.SeriesCollection(i).Border.ColorIndex = arrColors(i)
        
    Next i
    
End Sub
</pre> 

<p>Rather than looping through an array, you could just as easily refer to each of the series individually.  To do so, the code would look like this:</p>

<pre>
Sub Color_Series()

    Dim Cht As ChartObject
    
    'Series 1 - ColorIndex = 3 = Red = Current Year (2010)
    'Series 2 - ColorIndex = 5 = Blue = Current Year Plan (2010)
    'Series 3 - ColorIndex = 10 = Green = Prior Year (2009)
    'Series 4 - ColorIndex = 16 = Silver = Prior Year (2008)
    'Series 5 - ColorIndex = 15 = Prior Year (2007)
    'Series 6 - ColorIndex = 14 = Silver = Prior Year (2006)
    
    Set Cht = Worksheets("Sheet1").ChartObjects("Chart01")
    
    Cht.Chart.SeriesCollection(1).Border.ColorIndex = 3
    Cht.Chart.SeriesCollection(2).Border.ColorIndex = 5
    Cht.Chart.SeriesCollection(3).Border.ColorIndex = 10
    Cht.Chart.SeriesCollection(4).Border.ColorIndex = 16
    Cht.Chart.SeriesCollection(5).Border.ColorIndex = 15
    Cht.Chart.SeriesCollection(6).Border.ColorIndex = 16
        
End Sub
</pre> 

<br/>


            <hr /> 
            <p>Posted on: January 11, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/Charts/">Charts</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/vba_array_to_change_line_chart_colors/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>Charts</dc:subject>
      <dc:date>2010-01-11T11:00:34+00:00</dc:date>
    </item>

    <item>
      <title>VBA Function to Screen for Certain Charts</title>
      <link>http://www.cellmatrix.net/index.php/site/vba_function_to_screen_for_certain_charts/</link>
      <guid>http://www.cellmatrix.net/index.php/site/vba_function_to_screen_for_certain_charts/</guid>
      <description>
            <![CDATA[<p>Until late last year I've primarily worked with Excel 2003 because that's what we use at work.  However, that changed over the holidays because my home computer crashed and the new one came with Excel 2007.  I was trying to wait until Excel 2010 was available before buying a new computer but the old machine just couldn't make it that long.</p>

<p>It seems like most of what I've read regarding the Excel 2007 ribbon has been negative.  However, after using Excel 2007 for a couple of weeks my initial impressions are that I like it.  Although the ribbon can't be modified as easy as the toolbars were in previous versions, having the ability to create your own ribbon tabs makes up for that problem for me.  And having the ability to customize the quick access toolbar makes up for inefficiencies in the placement of the ribbon commends.</p>

<p>Now that I've made the move to 2007, I need to rebuild several add-ins that I've created to interface with the ribbon.  One of the add-ins that I've created is for working with embedded charts only.  Built into that add-in is a function written by <a href="http://spreadsheetpage.com/" title="John Walkenbach">John Walkenbach</a> that alerts the user if he or she failed to select a chart.  After screening for a chart selection, I've added a second chart-screening function that utilizes a case statement to alert the user if an "improper" chart type is selected.  In the example, an improper chart is by my definition only.  That second chart-screening function follows:</p>

<p>First, declare an optional public variable containing the name of the application (add-in).</p>

<pre>
Option Explicit
Public Const APPNAME As String = "Position Chart Labels"
</pre>

<p>Next, provide the code that triggers the user form.  "ValidContext" references the chart screening function below.</p>

<pre>
Sub MoveChartLabels()
    If ValidContext(True) Then frmMoveLabels.Show
End Sub
</pre>

<p>Finally, provide the chart screening function.  If the chart type appears as a line in the code below the function considers the chart to be valid.  If not, the function kicks out an error message.  The function works with combination charts because it evaluates each individual chart series for the accepted chart type.</p>

<pre>
Private Function ValidContext(ChtType) As Boolean
   
    Dim Sr As Series
    Dim Srs As SeriesCollection
    
    Const MsgChtType As String = "Invalid chart type."
        
    Set Srs = ActiveChart.SeriesCollection
    
    For Each Sr In Srs
     
        Select Case Sr.ChartType
            
            'Accepted Line Charts
            Case xlLine: ValidContext = True
            Case xlLineStacked: ValidContext = True
            Case xlLineStacked100: ValidContext = True
            Case xlLineMarkers: ValidContext = True
            Case xlLineMarkersStacked: ValidContext = True
            Case xlLineMarkersStacked100: ValidContext = True
            
            'Accepted Column Charts
            Case xlColumnClustered: ValidContext = True
            Case xlColumnStacked: ValidContext = True
            Case xlColumnStacked100: ValidContext = True
        
            'Accepted Bar Charts
            Case xlBarClustered: ValidContext = True
            Case xlBarStacked: ValidContext = True
            Case xlBarStacked100: ValidContext = True
                    
            'Accepted Area Charts
            Case xlArea: ValidContext = True
            Case xlAreaStacked: ValidContext = True
            Case xlAreaStacked100: ValidContext = True
            
            'Accepted XY Scatter Charts
            Case xlXYScatter: ValidContext = True
            Case xlXYScatterSmooth: ValidContext = True
            Case xlXYScatterSmoothNoMarkers: ValidContext = True
            Case xlXYScatterLines: ValidContext = True
            Case xlXYScatterLinesNoMarkers: ValidContext = True
    
            'Accepted Pie Charts
            Case xlPie: ValidContext = True
            Case xlPieExploded: ValidContext = True
            Case xlPieOfPie: ValidContext = True
            Case xlBarOfPie: ValidContext = True
            
            Case Else
                ValidContext = False
                MsgBox MsgChtType, vbCritical, APPNAME
                Exit Function
        
        End Select

    Next Sr
    
End Function
</pre>

<br/>
            <hr /> 
            <p>Posted on: January 08, 2010  |
            Filed Under: <a href="http://www.cellmatrix.net/index.php/site/category/Charts/">Charts</a> | 
            <a href="http://www.cellmatrix.net/index.php/site/comments/vba_function_to_screen_for_certain_charts/">Comments:</a> (0)</p> 
            ]]>
      </description>
      <dc:subject>Charts</dc:subject>
      <dc:date>2010-01-08T11:10:41+00:00</dc:date>
    </item>

    </channel>
</rss>