Clear value in cell when the "enter" key is pressed
Hi,
Right click your sheet tab, view code and paste this in
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A60")) Is Nothing Then
If IsNumeric(Target) Then
Application.EnableEvents = False
Target.Offset(, 1).Value = Target.Offset(, 1).Value + Target.Value
Target.Value = ""
Application.EnableEvents = True
Else
'optional line to delete any text entered in range
'Target.Value = ""
End If
End If
End Sub
Mike
"ksfarmer" wrote:
I have a work area of 4 columns wide and 60 rows long
I need the following macro
1. I enter numbers in column A1
2. Accumulate them in Column B1
3. Clear the value in Column A1 when "enter" key is pressed
4. Enter a new number in Column A1
5. Acumulate that in Column B1
6. Clear the value in Column A1 when the "enter" key is pressed
7 repeat as data entry requires.
This same routine would be applied to A2-B2 through row A60-B60
Any help appreciated..
|