Select One Cell or Another

M

Maxemily

Hello,

How would I allow someone to put an 'x' in one of two cells but not i
both?

Also, as there would need to be an 'x' in one of the two cells only i
there were text in a different cell, is there a way to indicate th
need for the 'x' should text be inserted but the 'x' omitted?

Clear as mud huh?

Thank
 
D

davesexcel

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
If Union(Range("$A:$A"), Target).Address = Range("$A:$A").Address Then
With Selection.Font
..Name = "Webdings"
End With
ActiveCell.FormulaR1C1 = "r"
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
End If
Cancel = True

If Union(Range("$B:$B"), Target).Address = Range("$B:$B").Address Then


With Selection.Font
..Name = "Webdings"
End With
ActiveCell.FormulaR1C1 = "r"
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.ClearContents
End If

End Sub


Here's a macro I just recorded, using macro recorder then inserted the
code into the worksheet module

right click on the sheet tab and select view codes
there will be a box with the word (GENERAL)
hit the arrow to select worksheet
copy and paste the above code into that worksheet module

Now right click a cell in column A or B and a x mark will show in one
of the cells
 
D

Door

The simple way is to use conditional format on the two 'X' cells,
specify two conditions, (assuming text in A1, and x in B1 or C1)

for cell B1 - conditional format Formula=
=AND(A1="",B1="x")
set cell colour to red, and a second condition
=AND(C1="x",B1="x")
set cell colour to red

for cell C1, almost the same
=AND(A1="",C1="x")
set cell colour to red, and
=AND(C1="x",B1="x")
set cell colour to red

The other way is to use VBA code.
 
M

Maxemily

Thanks for your help.

Now I have a new problem: all but the security option in Tools/Macro i
faded out no matter which security setting is used.

Help a noob(ish) out please
 
Top