+ Reply to Thread
Results 1 to 3 of 3

Worksheet Events

  1. #1
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Worksheet Events

    I would like to capture the cell address a user enters data.

    I have tried the following:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim myRow As Long, myColumn As Long
    myRow = Selection.Row
    myColumn = Selection.Column
    End Sub

    This works perfectly if the user enters the value and then presses the <Enter> key.

    However if the user enters data and then clicks into a different cell without hitting the <Enter> key, it captures the address of the new cell.

    The same issue is present whether I use the Worksheet_Calculate and Worksheet_SelectionChange events.

    What I am trying to do is automatically insert a new row immediately below the row the data was entered into (a specific column's data entry). I need to do this because we want to maintain a specific format (also identify the new data range) and users will utilize many different methods of doing this manually. They invariably cause issues with identifying a specific data range or they mess up the format.

    I have my routine for inserting a new row, setting the format, and identifying the new data range. I just need to know how to make sure I have the cell the data was actually entered into rather than the new cell if they enter by moving to a new cell.
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Response

    If you change 'Selection' to 'Target' you will get what you need.
    Martin

  3. #3
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Thank You MRICE

    Works perfectly now!!

    Thanks again to all who answer our questions!!!

+ 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