ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save Copy or Cut Reference (https://www.excelbanter.com/excel-programming/405928-save-copy-cut-reference.html)

Matthew Pfluger

Save Copy or Cut Reference
 
When a macro or an event is run, often CutCopyMode is set to FALSE (lost).
Has anyone put together any code that saves this information? I'd like to
wrap my existing Worksheet_Activate event with something that saves or
re-enables CutCopyMode with the previous reference so that users can bring
data into a new form.

Thanks,
Matthew Pfluger

FSt1

Save Copy or Cut Reference
 
hi
use a variable instead of copy(to the clipboard)
'note: string = text, long = nondecimal number, single or double = decimal
number
'look up data types in vb help
dim rng as string ' declare your variable
Set rng = Range("A1").value 'set the value of the variable
vb will hold the variable untill the sub ends then poof. gone.
this avoids the clipboard all togeather.

hope this helps
Regards
FSt1

"Matthew Pfluger" wrote:

When a macro or an event is run, often CutCopyMode is set to FALSE (lost).
Has anyone put together any code that saves this information? I'd like to
wrap my existing Worksheet_Activate event with something that saves or
re-enables CutCopyMode with the previous reference so that users can bring
data into a new form.

Thanks,
Matthew Pfluger


Matthew Pfluger

Save Copy or Cut Reference
 
Sorry, I must not have been specific enough. I'm talking about range or
other objects. For example, say I want to copy a column of cells to a
worksheet that contains an _Activate event. It is likely that the reference
to the copy range will be lost in that time.

I was hoping that someone had something coded that I could call like this:

private sub Worksheet_Activate
call StoreCutCopyMode()
'... code here
call RestoreCutCopyMode()
end sub

If I come up with anything, I will be sure to share it here.

Thanks,
Matthew Pfluger



"FSt1" wrote:

hi
use a variable instead of copy(to the clipboard)
'note: string = text, long = nondecimal number, single or double = decimal
number
'look up data types in vb help
dim rng as string ' declare your variable
Set rng = Range("A1").value 'set the value of the variable
vb will hold the variable untill the sub ends then poof. gone.
this avoids the clipboard all togeather.

hope this helps
Regards
FSt1

"Matthew Pfluger" wrote:

When a macro or an event is run, often CutCopyMode is set to FALSE (lost).
Has anyone put together any code that saves this information? I'd like to
wrap my existing Worksheet_Activate event with something that saves or
re-enables CutCopyMode with the previous reference so that users can bring
data into a new form.

Thanks,
Matthew Pfluger



All times are GMT +1. The time now is 04:53 AM.

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