ShabanaHafiz
Programmer
I need to clear contents of few cells based on value change in one cell. I placed the following code in Worksheet_Change event:
This didn’t work. I placed a messagebox for debugging on the first line:
Msgbox ActiveCell.Address
It was found that Change event fired when I changed the value and pressed enter to move the highlighter to next cell (A3). So answer in message box was $A$3. How can I get the reference $A$2 to clear contents of A8,A9,A10 based on value change in A2.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Address <> "$A$2" Then
Exit Sub
Else
ActiveSheet.Range("A8,A9,A10").ClearContents
End If
End Sub
This didn’t work. I placed a messagebox for debugging on the first line:
Msgbox ActiveCell.Address
It was found that Change event fired when I changed the value and pressed enter to move the highlighter to next cell (A3). So answer in message box was $A$3. How can I get the reference $A$2 to clear contents of A8,A9,A10 based on value change in A2.