Function and Data in a Cell

S

Sarah

I was wondering if it is possible to enter data into a cell on the worksheet and there also being a function in that cell to

For Example cell A1 I enter data of '50' and the function automatically adds '100' leaving the data displayed in cell A1 as'150

Any help much appreciated
 
G

Gord Dibben

Sarah

Not without resorting to VBA.

Well, there is way "after the fact". Enter your number then enter 100 in
another cell. Copy it and Paste Special>Add>OK>Esc to the original cell.

If you had a great many of these cells, that may be the easiest. You can
select all the cells before Paste Special>Add step.

The code below pasted into a worksheet module will add 100 to any number you
enter in Column A.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count > 1 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
Application.EnableEvents = False
With Target
.Value = .Value + 100
Application.EnableEvents = True
End With
End Sub

Copy and right-click on the sheet tab and "View Code". Paste in there.

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top