Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default adding to a number already in a cell

As an example for Cell B9, paste this in the sheet code for that sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sform As String
If Target.Count 1 Then Exit Sub
If Target.Address = "$B$9" Then
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
sVal = Trim(Target.Text)
Application.Undo
If Not IsNumeric(sVal) Then _
GoTo Errhandler
sform = Target.Formula
If Left(sform, 1) < "=" Then
sform = "=" & sform & "+" & sVal
Else
sform = sform & "+" & sVal
End If
Target.Formula = sform
End If
Errhandler:
Application.EnableEvents = True
End Sub

Now if you enter values in B9, it will do what you describe.
Lightly tested, but represents the basic approach.

--
Regards,
Tom Ogilvy

"conrad" wrote in message
...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the

total
and the display of the cell contents to list the individual numbers added.



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
Adding number within a cell Jon A Excel Worksheet Functions 5 February 4th 08 04:06 PM
Adding a number to a cell that already has a number. paula Excel Discussion (Misc queries) 3 January 15th 08 04:41 PM
macro adding a number to a number already in a cell Tom Ogilvy Excel Programming 0 October 18th 03 04:34 PM
macro adding a number to a number already in a cell Don Guillett[_4_] Excel Programming 0 October 17th 03 05:21 PM
macro adding a number to a number already in a cell Ron de Bruin Excel Programming 0 October 17th 03 04:59 PM


All times are GMT +1. The time now is 04:58 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"