View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Sub to ensure a single, latest input of "x" in col G

Assuming the only text in Column G is to be this single X, then this event
code should do what you want...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 Then
Application.EnableEvents = False
Columns("G").Clear
Target.Value = "X"
Application.EnableEvents = True
End If
End Sub

To install it, right click the tab at the bottom of the worksheet that is to
have this functionality, select View Code from the popup menu that appears
and then copy/paste the above code into the code window that opened up. Now
go back to the worksheet and type in your X (actually, as written, any text
will do) in any cell in Column G, then put the X in a cell in Column G.

--
Rick (MVP - Excel)


"Max" wrote in message
...
Looking for a sub which can ensure that only a single, latest "x" can be
input at any one time within col G. If say, G2 already contains: x, and I
input another: "x" into G4, the sub should clear G2 before accepting G4's
input. Something like a toggle. Thanks