ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining last copied range (https://www.excelbanter.com/excel-programming/291169-determining-last-copied-range.html)

R Avery

Determining last copied range
 
I have the following problem - I often have to copy a range, then paste in a
bunch of places, and then go back to the copied range and make changes. And
since it is often in different worksheets and a lot of scrolling is
involved, it is a very time-consuming process that i would like to automate.

Is there anyway, programmatically, to determine the Address of the copied
range? Or, alternatively, is there some OnCopy event that I can trap and
use to determine the copied range? Ideally, I would like to have a button
or shortcut key that would always bring me back to the site of last copy.

I already have an implementation that would work, if only I was able to
track the event... Is this possible?

Any help would be appreciated.



Bob Phillips[_6_]

Determining last copied range
 
Can't think of any event you can use, and they would all be subject to other
actions. So I think you need to build the whole process

Something like this. Select your cells, run the CopySelection macro, go and
do the pasting, then run the Selection Return macro. Both could be assigned
to Toolbar buttons

Dim rngSelect As Range

Sub CopySelection()
Selection.Copy
Set rngSelect = Selection
End Sub

Sub SelectionReturn
rngSelect.Select
End Sub

Put this all in the same standard code module. Ensure that rngSelect is
declared outside of the macros.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"R Avery" wrote in message
...
I have the following problem - I often have to copy a range, then paste in

a
bunch of places, and then go back to the copied range and make changes.

And
since it is often in different worksheets and a lot of scrolling is
involved, it is a very time-consuming process that i would like to

automate.

Is there anyway, programmatically, to determine the Address of the copied
range? Or, alternatively, is there some OnCopy event that I can trap and
use to determine the copied range? Ideally, I would like to have a button
or shortcut key that would always bring me back to the site of last copy.

I already have an implementation that would work, if only I was able to
track the event... Is this possible?

Any help would be appreciated.





R Avery

Determining last copied range
 
That is a very good idea. I can replace the Ctrl-c shortcut with the new
copy macro... and i still have ctrl-insert for regular copy. its great!




All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com