[VBA] Detecting changes in cell

Last update on October 2, 2009 12:01 PM by jak58
Published by netty5

[VBA] Detecting changes in cell









The Event Change feature of a sheet will detects the change in the active cell but it gives no information about the content.
The example given below will help you to find out if the cell was changed, if it still works after being initialized or amended.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static AncAdress As String, AncCell As Variant
    If AncAdress <> "" Then 'for first initialization.
        If AncCell <> Range(AncAdress) Then
            'The cell that you just left has been changed. 
            'Put action to be taken.
            Stop
        End If
    End If
    AncAdress = Target.Address
    AncCell = Target.Value2
End Sub


Note that:
When the event change is activated, the contents of the cell that has just been selected to be in Target. but the module above the test the cell that has been left.
Best answers for « Detecting changes in cell » in :
Windows Update – Detection Frequency Configuration ShowWindows Update – Detection Frequency Configuration By the registry On the Control Panel Vista XP You can change the Update detection frequency on windows because windows does automatically searches for updates! By the registry Save...
Colouring cells on conditions ShowColouring cells on conditions There are many pratical functions under Excel which is not commonly used. Example: If you wish a cell automatically turns red (or other formatting border, frame etc) under one condition: a result, a...
How to change or recover your Windows Live Messenger password ShowHow to change or recover your Windows Live Messenger password 1.Changing your password (Windows Live Messenger) 2. Password Recovery Secret question Send password reset instructions to your alternative email address Download MSN Messenger...
Download Driver Detective ShowDescription Driver Detectiveis an application designed by Drivers Headquarters, Inc. This application will allow you between others to prove every time if you have last updates for the drivers of your equipments. Advantage The application...
Download Caledos Automatic Wallpaper Changer ShowCaledos Automatic Wallpaper Changer, as its name indicates, is a screen background administrator. The main features of Caledos : - it supports the image formats BMP, GIF, JPG, TIF, - easy selection of files or folders, - the possibility of...
Spreadsheets - Cell Selection ShowCell Selection Spreadsheets are powerful tools for working with data. However, to work with data, it is necessary to have tools to rapidly choose the required cells. Line Selection An entire line can be chosen by clicking directly on the line...
Intrusion detection systems (IDS) ShowIntroduction to intrusion detection systems An IDS (Intrusion Detection System) is the term for a mechanism which quietly listens to network traffic in order to detect abnormal or suspicious activity, thereby reducing the risk of intrusion. There...
Resistance to change ShowResistance to change To be in a position to anticipate change, it is essential to understand the risk factors and in particular the causes that prevent change. Apart from individual causes, before focusing attention on a case by case basis,...