calandrelli
Technical User
I have a worksheet in Excel. A row represents a record and the row under it is a multiple of the record above it. (Qty x Cost). In the example below let's simplify it and assume that the cost is $2 for any item.
If I use the Change Event I can capture the change and made the cell under the target by multiplied by 2. I use the Application.EnableEvents to stop the code from looping.
This works great when the user changes one cell at a time. However the data in the sheet is a monthly forecast and the users are using Copy and Past to paste Jan through December into the row all at once. Passing A$1:A$10 as the target causes it to fail. Can I capture a multicell paste and multiply each cell in the array of values by 2?
If I use the Change Event I can capture the change and made the cell under the target by multiplied by 2. I use the Application.EnableEvents to stop the code from looping.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range(Target.Address).Offset(1, 0).Value = Range (Target.Address).Value * 2
Application.EnableEvents = True
End Sub
This works great when the user changes one cell at a time. However the data in the sheet is a monthly forecast and the users are using Copy and Past to paste Jan through December into the row all at once. Passing A$1:A$10 as the target causes it to fail. Can I capture a multicell paste and multiply each cell in the array of values by 2?