![]() |
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. -- DCSwearingen ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=545102 |
Worksheet Events
If you change 'Selection' to 'Target' you will get what you need. -- mrice Research Scientist with many years of spreadsheet development experience ------------------------------------------------------------------------ mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931 View this thread: http://www.excelforum.com/showthread...hreadid=545102 |
Worksheet Events
Works perfectly now!! Thanks again to all who answer our questions!!! -- DCSwearingen Getting old, but love computers. ------------------------------------------------------------------------ DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506 View this thread: http://www.excelforum.com/showthread...hreadid=545102 |
All times are GMT +1. The time now is 10:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com