Private Sub Worksheet_Change(ByVal Target As Range)
Set A78 = Range("A7:A8")
Set A7 = Range("A7")
Set A8 = Range("A8")
Set C3 = Range("C3")
If Intersect(A78, Target) Is Nothing Then Exit Sub
If A7 < 2 Or A8 < 2 Then Exit Sub
Application.EnableEvents = False
C3.Value = 0
Application.EnableEvents = True
End Sub
Because it is worksheet code, it is very easy to install and automatic to use:
1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window
If you have any concerns, first try it on a trial worksheet.
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
--
Gary''s Student - gsnu200814
"Kenneth" wrote:
I diverted my question from General Question as I think my problem related to
programming.
Hi all,
I have a table, let say B2:F6
when I type the 2 in A7, 2 in A8
the value in C3 will be removed or changed to zero.
Do I need to use macro to do?
B2:F6 is the source. I am not available to change them to equations.
Thanks,
Kenneth