ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   update cell without loosing previous data (https://www.excelbanter.com/excel-discussion-misc-queries/132300-update-cell-without-loosing-previous-data.html)

Susan

update cell without loosing previous data
 
My stock sheets are set up with a goods inwards colum. Every delivery I enter
my invoices into a goods recived colum. So the first entry is =2. Next entry
the following week I select the cell wich now has (=2) and in the tool bar
place the curser next to the 2 and type plus then the next entry. So =2+3.
and get a running total. Can ayone tell me how I can eliminate the need to
place the curser in the window and just select the cell and begin to type
updated data.

Rich[_2_]

update cell without loosing previous data
 
you could just double click on the cell and the do the + bit at the end of
the current formula,, but this would have the same effect as clicikng on the
formula bar



"Susan" wrote:

My stock sheets are set up with a goods inwards colum. Every delivery I enter
my invoices into a goods recived colum. So the first entry is =2. Next entry
the following week I select the cell wich now has (=2) and in the tool bar
place the curser next to the 2 and type plus then the next entry. So =2+3.
and get a running total. Can ayone tell me how I can eliminate the need to
place the curser in the window and just select the cell and begin to type
updated data.


JE McGimpsey

update cell without loosing previous data
 
One way:

Assume your goods inward column is column C. Put this in your worksheet
code module (right-click the worksheet tab and choose View Code):

Const nCOLUMN As Long = 3 'Column C
Dim sOldFormula As String

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If ActiveCell.Column = nCOLUMN Then
sOldFormula = ActiveCell.Formula
Else
sOldFormula = vbNullString
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If .Column = nCOLUMN Then
If .HasFormula Then Exit Sub 'already a formula
If IsNumeric(.Value) Then
On Error Resume Next
Application.EnableEvents = False
If Left(sOldFormula, 1) = "=" Then
.Formula = sOldFormula & "+" & .Value
Else
.Formula = "=" & .Value
End If
Application.EnableEvents = True
On Error GoTo 0
End If
sOldFormula = .Formula
End If
End With
End Sub

Change nCOLUMN to suit.

In article ,
Susan wrote:

My stock sheets are set up with a goods inwards colum. Every delivery I enter
my invoices into a goods recived colum. So the first entry is =2. Next entry
the following week I select the cell wich now has (=2) and in the tool bar
place the curser next to the 2 and type plus then the next entry. So =2+3.
and get a running total. Can ayone tell me how I can eliminate the need to
place the curser in the window and just select the cell and begin to type
updated data.



All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com