Last year I made some modifications to Fabrice Rimlinger's open source
sparklines tool for a project I was working on, and added some help text. It
has been too long for me to remember all the details, but the snippet below
may lead you in the right direction.
HTH,
Keith
Sub PiechartCreate3() 'PieChartCreate3
Dim StrDescription As String 'limit of approx 250 characters or
macroOptions throws an error
'there also seems to be a limit of 3
visible lines/rows total
StrDescription = _
"If SUM(range) < 1 use 'SmallValueKey':" & Chr(13) & _
" 1: Show values as-is" & Chr(13) & _
" 2: Show values as a % of SUM(range); automatically totals 100%"
Application.MacroOptions Macro:="PieChart3", Description:=StrDescription
Dim OldFormula As String
OldFormula = ActiveCell.formula
OldFormula = Replace(OldFormula, "=+", "=")
If Not LCase(Left(ActiveCell.formula, 11)) = "=piechart3(" Then
ActiveCell = "=piechart3()"
Application.Dialogs(xlDialogFunctionWizard).Show
If LCase(ActiveCell.formula) = "=piechart3()" Then
ActiveCell.formula = OldFormula
Else
ActiveCell.Calculate
End If
End Sub