How do I determine the Range that was pasted

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I want to detect the cells that change on a worksheet as a result of a
manual copy. For example, I manually select the Range("F16:G26") on some
other sheet in another Workbook, copy that range, and then click a cell in
the active sheet and paste it.

Using the function below I can determine the cell that was clicked and
changed, but, how do I determine the range of cells that were changed.



Private Sub Worksheet_Change(ByVal Target As Range)

Dim aa, cc, rr

aa = Target

cc = Target.Column

rr = Target.row

End Sub
 
Not really following you. Whe I run this code it gives me tha trange that was
changed when an etire range of cells are copied in...

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox Target.Address
End Sub

I must be missing something...
 
There is a neat trick:

Say you are copying from Sheet1 to Sheet2 in a total different set of cells.
After the Paste in Sheet2, the affected cells are Selected, even though you
selected only one cell as the paste target. So:

Sub where()
Sheets("Sheet2").Activate
s = Selection.Address
MsgBox (s)
End Sub

should reveal the total region pasted in Sheet2.
 
Thanks to both Jim and Gary's Student. Both of your suggestions are what I'm
looking for.

thanks,
mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top