![]() |
Select One Cell or Another
Hello, How would I allow someone to put an 'x' in one of two cells but not in both? Also, as there would need to be an 'x' in one of the two cells only if there were text in a different cell, is there a way to indicate the need for the 'x' should text be inserted but the 'x' omitted? Clear as mud huh? Thanks -- Maxemily |
Select One Cell or Another
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 -- davesexcel ------------------------------------------------------------------------ davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708 View this thread: http://www.excelforum.com/showthread...hreadid=528905 |
Select One Cell or Another
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. Maxemily Wrote: Hello, How would I allow someone to put an 'x' in one of two cells but not in both? Also, as there would need to be an 'x' in one of the two cells only if there were text in a different cell, is there a way to indicate the need for the 'x' should text be inserted but the 'x' omitted? Clear as mud huh? Thanks -- Maxemily -- Door ------------------------------------------------------------------------ Door's Profile: http://www.excelforum.com/member.php...o&userid=33068 View this thread: http://www.excelforum.com/showthread...hreadid=528905 |
Select One Cell or Another
Thanks for your help. Now I have a new problem: all but the security option in Tools/Macro is faded out no matter which security setting is used. Help a noob(ish) out please! -- Maxemily |
Select One Cell or Another
which option did you take?? -- davesexcel ------------------------------------------------------------------------ davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708 View this thread: http://www.excelforum.com/showthread...hreadid=528905 |
All times are GMT +1. The time now is 12:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com