Sum Help

D

Dan W

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top