View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
davesexcel
 
Posts: n/a
Default 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