Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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 enter
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 c
value should get

overwritten by the summation of the 4 cells.

your help is appreciated
thanx in advance,
a_k9

--
a_k9
-----------------------------------------------------------------------
a_k93's Profile: http://www.excelforum.com/member.php...fo&userid=3267
View this thread: http://www.excelforum.com/showthread.php?threadid=52571

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summation based on contents of another cells Flashyfuture Links and Linking in Excel 1 January 11th 12 06:23 PM
Is there a way of copying summation or count of highlighted cells? Mohan Excel Discussion (Misc queries) 0 October 3rd 08 10:01 AM
summation to show at the bottom when I highlight selected cells? Joyousmarie Excel Worksheet Functions 2 February 16th 07 05:32 PM
VBA code to perform summation and product summation 21MSU[_2_] Excel Programming 4 May 17th 04 07:19 PM
Summation of cells tied to Checkboxes Excel-erate2004[_6_] Excel Programming 3 April 24th 04 09:07 PM


All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"