View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default circular reference code

I believe you would have to include a public, module level variable in the
worksheet module to hold the current value.

This code goes in the Sheet1 module

Public A1Value As Double

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
A1Value = A1Value + Target.Value
Application.EnableEvents = False
Target.Value = A1Value
Application.EnableEvents = True
End If
End Sub

and this in the ThisWorkbook module

Private Sub Workbook_Open()
A1Value = Worksheets("Sheet1").Range("A1").Value
End Sub





On Fri, 19 Nov 2004 08:46:04 -0600, marksuza
wrote:


Hi again,

I dont know if the code I inputed in my first message was the most
appropriate, or if that diverted from the real problem. Basically, I
want to input a number in a cell and add the number I input to the
previous number that was in that cell. Thanks again.

Marcos