Thread: Summation
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dan W. Dan W. is offline
external usenet poster
 
Posts: 1
Default Summation

Hello,

I need a little help with a special vba summation code -
if its possible.

I currently use vba code to force cells to autosum within
macros and keep the formula. Such as:

Sub DoAutoSum()
Dim x As CommandBarControl
Set x = CommandBars.FindControl(ID:=226)
If Val(Application.Version) = 10 Then _
Set x = x.Controls(1)
x.Execute
If Selection.Cells.Count = 1 Then
x.Execute 'Again to exit edit mode if only one cell
is selected
End If
End Sub


The change I want to make is when the formula shows up in
Excel. It currently shows something like this:
=SUM(I12:I19)

However for my special situation I would Like it to show
something like this:
=SUM(I18,I17,I16,I15,I14,I13,I12)

Is this possible using a similar line of vba code as above.

And a very basic question - (I just cannot remember) is
there a limit to how long this formula can be in Excel.


Thank You