Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default makro that sums every new number entered in cell

my problem:
i want to enter a number in A1
and everytime when u enter a number in a1 the macro adds the new number to
the old one BUT in the end there sould be the hole thing in the cell as
code...


A1 A1 - 0
input "14" in A1 A1 - 14
input "10" in A1 A1 - 24
input "-2" in A1 A1 - 22

at the end A1 = "14 + 10 - 2 " = 22

so that u can controll what is typed in

kind regards
mario


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default makro that sums every new number entered in cell

This may not be the most elegant solution but it works:


Public oldvalue
Public Done As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
If Done Then Exit Sub
If oldvalue = Target.Value Then Exit Sub
If Target.Address = "$A$1" Then
Done = True
[A1] = oldvalue + Target.Value
End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Address < "$A$1" Then Exit Sub
oldvalue = Target.Value
Done = False
End Sub




"Mario" wrote in message
y.telekom.at...
my problem:
i want to enter a number in A1
and everytime when u enter a number in a1 the macro adds the new number to
the old one BUT in the end there sould be the hole thing in the cell as
code...


A1 A1 - 0
input "14" in A1 A1 - 14
input "10" in A1 A1 - 24
input "-2" in A1 A1 - 22

at the end A1 = "14 + 10 - 2 " = 22

so that u can controll what is typed in

kind regards
mario




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default makro that sums every new number entered in cell

This file might be a help:
http://www.bygsoftware.com/examples/...ainFormula.zip

It's in the "Worksheets with VBA" section on page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how user input is captured and used to amend a formula with
the "SheetSelectionChange" event.

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"


"Mario" wrote in message
y.telekom.at...
my problem:
i want to enter a number in A1
and everytime when u enter a number in a1 the macro adds the new number to
the old one BUT in the end there sould be the hole thing in the cell as
code...


A1 A1 - 0
input "14" in A1 A1 - 14
input "10" in A1 A1 - 24
input "-2" in A1 A1 - 22

at the end A1 = "14 + 10 - 2 " = 22

so that u can controll what is typed in

kind regards
mario




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default makro that sums every new number entered in cell

See one solution in .m.p.excel:




In article
lekom.at,
"Mario" wrote:

my problem:
i want to enter a number in A1
and everytime when u enter a number in a1 the macro adds the new number to
the old one BUT in the end there sould be the hole thing in the cell as
code...


A1 A1 - 0
input "14" in A1 A1 - 14
input "10" in A1 A1 - 24
input "-2" in A1 A1 - 22

at the end A1 = "14 + 10 - 2 " = 22

so that u can controll what is typed in

kind regards
mario


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
Display number only if entered in a cell JW Excel Worksheet Functions 4 March 6th 09 09:09 PM
Excel - in a row of numbers, put last entered number Cell B2 RJ Excel Discussion (Misc queries) 7 October 25th 08 10:08 PM
Number entered in cell getting always divided by 100 ! Dipen Setting up and Configuration of Excel 5 August 28th 08 03:28 PM
Number entered isn't number recorded in cell. BubbaGee Excel Discussion (Misc queries) 4 September 11th 07 09:38 PM
cell that only a certain number may be entered jbailey Excel Worksheet Functions 7 August 24th 06 11:09 PM


All times are GMT +1. The time now is 04:30 PM.

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

About Us

"It's about Microsoft Excel"