PDA

View Full Version : Clearing contetn of cells



johnnyexit
12-14-2015, 05:02 AM
Hi,

can you help me please with clearing content of cells. I have range of cells from A1 - B1 - C1 - D1. When I put "x" some formulas is calculate. Next when put "x" in B1
A1-C1-D1 needs to be clear, and same in other possibilities.

Tnx in advice.

johnnyexit
12-14-2015, 12:10 PM
anybody

mperrah
12-14-2015, 02:33 PM
1) what formula are you are running?
2) where is the data that gets manipulated?
3) do you only put an "X" in one of these 4 cells at a time?

We can make a SheetChange code fire when an "X" is in the target cells, and clear the other cells if that is what you are looking to do?


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Target.Row = 1 Then
With Target
If .Column = 1 Then
' code if A1 is selected
If .Column = 2 Then
' code if B1 is selected
If .Column = 3 Then
' code if C1 is selected
If .Column = 4 Then
' code if D1 is selected
End If
End With
End If
End Sub