I have cell A and cell B. Both the cells contain some numeric value, say 2.
Now if i put 3 in cell A, cell B value should automatically update to 5 and so on.
Again, if i put 5 in cell A, cell B value should be 10.
Hope i have made myself clear...
Any help would be really appreciated.
Thanks Rakesh
This will work for cells A1 and B1. Put the following event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A1"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
[B1] = [B1] + [A1]
Application.EnableEvents = True
End Sub
Because it is worksheet code, it is very easy to install and automatic to use:
If you have any concerns, first try it on a trial worksheet.
If you save the workbook, the macro will be saved with it. If you are using a version of Excel later then 2003, you must save the file as .xlsm rather than .xlsx
To remove the macro:
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
Macros must be enabled for this to work!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.