Thread: Macro?
View Single Post
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Macro?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B1:B100"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Offset(0, -1).Value < "" Then
If .Value = "X" Then
.Value = ""
Else
.Value = "X"
End If
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mjohnson" wrote in message
...
I am not sure what function I need to use, but what I am looking for is
this.... I have a spreadsheet that lists all of my tasks. As soon as a

task
is complete, I want to be able to click in the next column, same row, and
have an X populated in that field. I don't want to have to type the X.

As
soon as I click the cell with the mouse I want the X to appear, and if I
click the same cell again, I want the X to be removed. Is there an easy

way
to set this up? I was looking to see if there was any type of toggle

button
feature that would do this and was unsuccessful.

Thanks!