Hi. I have table with many rows of data, and I'd like to have certain cells copied in the same row when data is entered in a specific column in that row. This is what I have so far:
If the user presses the Tab key after entering data in column 29, then it runs just as I want it to run. The problem comes when the user presses the Enter key. Data in the wrong row is copied when that happens. Is there a way to detect if the Enter key is pressed which then would run code that would simply go back up one row and run the code to copy the cells in the active row? Or, is there a better way than what I'm thinking of doing? Hope that made sense. Thanks.
Private Sub worksheet_change(ByVal target As Range)
If target.Column = 29 Then
Thisrow = target.Row
If target.Value <> "" Then
Cells(ActiveCell.Row, 3).Copy
...(more code that copies cells follows this)
End If
End If
End Sub
If target.Column = 29 Then
Thisrow = target.Row
If target.Value <> "" Then
Cells(ActiveCell.Row, 3).Copy
...(more code that copies cells follows this)
End If
End If
End Sub
If the user presses the Tab key after entering data in column 29, then it runs just as I want it to run. The problem comes when the user presses the Enter key. Data in the wrong row is copied when that happens. Is there a way to detect if the Enter key is pressed which then would run code that would simply go back up one row and run the code to copy the cells in the active row? Or, is there a better way than what I'm thinking of doing? Hope that made sense. Thanks.