+ Reply to Thread
Results 1 to 4 of 4

"x" marks the spot

  1. #1
    Registered User
    Join Date
    11-05-2004
    Posts
    21

    "x" marks the spot

    I am using this code to mark cells with an x to track certain things.
    When a cell is clicked on, it puts an x in the cell immediatley to the right. Does anyone know how to alter this code to put an "X" in the cell directly below a cell that is selected?


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Target.Column <> 6 And Target.Column <> 8 And Target.Column <> 10 And Target.Column <> 12 Then Exit Sub

    On Error GoTo errhandler
    Application.EnableEvents = False
    With Target.Offset(0, 1)
    If .Value = "" Then
    .Value = "X"
    Else
    .Value = ""
    End If
    End With

    errhandler:
    Application.EnableEvents = True
    End Sub


    Thanks for your help. Tawnee

  2. #2
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    Hi Tawnee: just change the offset arguements from

    With Target.Offset(0, 1)

    to

    With Target.Offset(1,0)

    the arguements define the offset (rows,cols) from the current location.

  3. #3
    Registered User
    Join Date
    02-02-2005
    Posts
    35
    Try changing the Offset function

    From
    With Target.Offset(0, 1)
    to
    With Target.Offset(1, 0)


    This should do the trick. Sorry not had a chance to test so fingers x

    RES

  4. #4
    Registered User
    Join Date
    11-05-2004
    Posts
    21

    Wink

    Thanks
    Guys!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1