Changing a value's cell to trigger an event i get a loop

  • Thread starter Thread starter stakar
  • Start date Start date
S

stakar

I have a vb code
When i running the vb code i calculate some values. The following i
one

A B C D
---------------
10
8 X1
5 X2
40 X3
10 X4

The X1 is the result of $C$1/A2
The X2 is the result of $C$1/A3
The X3 is the result of $C$1/A4
The X4 is the result of $C$1/A5

I want each time i change the $C$1 to another value, to
recalculate the values.
I copy the part that i use in the main vb code and paste it
using the

'Private Sub Worksheet_Change(ByVal Target As Range)'

but each time that i rerun the main vbcode i get an endless loop
with the code under the private sub.
Can anyone tell me how to do that?

Another question is that do i have always to pass the parameters i
each new
procedure? Is there a way to make them public and use them everywher
?

Thanks in advance
Stathi
 
Stakar,

Have you disabled events at the start of the event code

Application.EnableEvents = False

and enabled them at the end

Application.EnableEvents = True
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top