VBA Script to Sum from Active Cell to Top of Column

Posted on 2003-03-10
Medium Priority
Last Modified: 2007-12-19
How would I substitute a full column rather than a static range in a summation formula for a cell?

similar to this which selects up to the top of the active column

       Range(Selection, Selection.End(xlUp)).Select

but use it in the formula below so as not to choose a static range for the sum?

       ActiveCell.FormulaR1C1 = "=(SUM(R[-8]C:R[-1]C)/100)"

Question by:kimbe1jm
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

JoaTex earned 225 total points
ID: 8104682

Adapt the Code to your Formula, Here each Cell is divided by 100.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Static bCritical As Boolean

   On Error GoTo err_Handler
   If Not bCritical Then
       bCritical = True
       Exit Sub
   End If
   For Each Cell In Target.Cells
       If Cell.Column = 1 And Cell.Row >= 1  Then
           Cell.Value = Cell.Value / 100
       End If
   Next Cell
   bCritical = False
End Sub

Hope it Suites you

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question