Making Cells Balance??

  • Thread starter Thread starter CWit
  • Start date Start date
C

CWit

Lets say I have three cells A1, A2, A3. Cell A1 = a whole number such a
100. Cell A2= a precentage of, lets say 50% and Cell A3= the answe
which is 50.

I want to be able to input data into any of the cells, so say I ente
100 into A3, it will work backward and change A1 to 200 or then
change A2 to 30% it changes A3 to 60.

Is there anyway of doing this, my problem is I put the formula i
Cells. And if I change the cells it deletes the formula.

Thanks for your help
 
one way (using an event macro):

Put this in your worksheet code module (right-click the worksheet tab
and choose view code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(.Cells, Range("A1:A3")) Is Nothing Then
Application.EnableEvents = False
Select Case .Address(False, False)
Case "A1"
Range("A2") = Range("A3").Value / .Value
Case "A2"
Range("A3").Value = .Value * Range("A1").Value
Case Else
Range("A1").Value = .Value / Range("A2").Value
End Select
Application.EnableEvents = True
End If
End With
End Sub

Note that I assumed that an entry in A1 should change A2 (you didn't
specify). If that's not the case, adjust the formula accordingly.
 

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

Back
Top