+ Reply to Thread
Results 1 to 2 of 2

Summation of the Cells

  1. #1
    Registered User
    Join Date
    03-21-2006
    Posts
    2

    Question Summation of the Cells

    Hi there,

    I want to sum up the value of the cell A1, A2, A3 and A4 in cell C1. this is done,
    by the following
    In the Worksheet_change Event
    c1.value = application.worksheetfunction.sum(a1,a2,a3,a4)

    User is allowed to enter value in c1 cell directly. If user enters value in C1 cell directly, at

    that time I want the Cell A1, A2, A3 and A4 should become 0.
    Again if the user enters in any of the cells (a1, a2, a3, a4) then c1 value should get

    overwritten by the summation of the 4 cells.

    your help is appreciated
    thanx in advance,
    a_k93

  2. #2
    Jim Thomlinson
    Guest

    RE: Summation of the Cells

    In the sheet itself place this code (Right click the sheet tab and select
    view code)

    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo ErrorHandler
    Application.EnableEvents = False
    If Not (Intersect(Target, Range("A1:A4")) Is Nothing) Then
    Range("C1").Value = Application.Sum(Range("A1:A4"))
    ElseIf Target.Address = "$C$1" Then
    Range("A1:A4").Value = 0
    End If
    ErrorHandler:
    Application.EnableEvents = True
    End Sub

    --
    HTH...

    Jim Thomlinson


    "a_k93" wrote:

    >
    > Hi there,
    >
    > I want to sum up the value of the cell A1, A2, A3 and A4 in cell C1.
    > this is done,
    > by the following
    > In the Worksheet_change Event
    > c1.value = application.worksheetfunction.sum(a1,a2,a3,a4)
    >
    > User is allowed to enter value in c1 cell directly. If user enters
    > value in C1 cell directly, at
    >
    > that time I want the Cell A1, A2, A3 and A4 should become 0.
    > Again if the user enters in any of the cells (a1, a2, a3, a4) then c1
    > value should get
    >
    > overwritten by the summation of the 4 cells.
    >
    > your help is appreciated
    > thanx in advance,
    > a_k93
    >
    >
    > --
    > a_k93
    > ------------------------------------------------------------------------
    > a_k93's Profile: http://www.excelforum.com/member.php...o&userid=32679
    > View this thread: http://www.excelforum.com/showthread...hreadid=525711
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1