I have a macro that runs OK when placed in a worksheet. This code will do the following in cell A1 of the “testx” worksheet: If cell A1 is empty when clicked, an “x” will become the value of cell A1, and if the value of cell A1 is “x” when clicked, the value of cell A1 will become “” (empty).
I need to have this work from an Add-In so that when any workbook that references the Add-In and contains the worksheet “testx” cell A1 will either be empty or contain an “x” when clicked.
I’ve checked the info at http://www.cpearson.com/excel/AppEvent.aspx, Pearson Software Consulting, and I did get the example to work, but I cannot get my code to work when I follow the example steps. I appreciate any help available.
My code is as follows:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Application.EnableEvents = False
If Target.Address = Worksheets("testx").Range("A1").Address Then
Select Case Target.Value
Case "x"
Target.Value = ""
Case Else
Target.Value = "x"
End Select
End If
Application.EnableEvents = True
End Sub
Bookmarks