ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Intercepting Paste Function (https://www.excelbanter.com/excel-programming/277768-intercepting-paste-function.html)

MrAlMackay

Intercepting Paste Function
 
Is it possible to intercept the paste function.

I've got formatting spreadsheet problems when people paste in data from their
own sheets / word.

What I'd like to be able to do is when they paste it actually invokes the Paste
Special function and pastes as values only (therefore my own formatting will be
in place).

Appreciate any help that you can offer.

Many Thanks, Al Mackay ( )

steve

Intercepting Paste Function
 
Al,
This code returns the state of paste, returns 1 for paste, otherwise it is
0.

Al Mackay

Intercepting Paste Function
 
Steve

Thanks for your help on this.

Will try this out.

Many thanks for your time.

Cheers, al.

"steve" wrote in message ...
Al,
This code returns the state of paste, returns 1 for paste, otherwise it is
0.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox Application.CutCopyMode
End Sub

Unfortunately, this is an after-the fact response. What you might try is
If Application.CutCopyMode = 1 then
*code to reformat the cells*
End If
The code could be nothing more than copying the format from cells above
the paste range and pastespecial format.

--
sb
"MrAlMackay" wrote in message
...
Is it possible to intercept the paste function.

I've got formatting spreadsheet problems when people paste in data from

their
own sheets / word.

What I'd like to be able to do is when they paste it actually invokes the

Paste
Special function and pastes as values only (therefore my own formatting

will be
in place).

Appreciate any help that you can offer.

Many Thanks, Al Mackay ( )


steve

Intercepting Paste Function
 
Al,

You're welcome! Hope you can get it to work...

--
sb
"Al Mackay" wrote in message
om...
Steve

Thanks for your help on this.

Will try this out.

Many thanks for your time.

Cheers, al.

"steve" wrote in message

...
Al,
This code returns the state of paste, returns 1 for paste, otherwise it

is
0.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox Application.CutCopyMode
End Sub

Unfortunately, this is an after-the fact response. What you might try

is
If Application.CutCopyMode = 1 then
*code to reformat the cells*
End If
The code could be nothing more than copying the format from cells above
the paste range and pastespecial format.

--
sb
"MrAlMackay" wrote in message
...
Is it possible to intercept the paste function.

I've got formatting spreadsheet problems when people paste in data

from
their
own sheets / word.

What I'd like to be able to do is when they paste it actually invokes

the
Paste
Special function and pastes as values only (therefore my own

formatting
will be
in place).

Appreciate any help that you can offer.

Many Thanks, Al Mackay ( )




Julie[_4_]

Intercepting Paste Function
 
Al,

What about creating a macro that calls for the Special Paste, then attach
the macro to a button. You can then have the button appear and disappear
with the form. You will just have to ask people who use the form to use your
special paste button not the one that they are use to.

Julie


"steve" wrote in message
...
Al,

You're welcome! Hope you can get it to work...

--
sb
"Al Mackay" wrote in message
om...
Steve

Thanks for your help on this.

Will try this out.

Many thanks for your time.

Cheers, al.

"steve" wrote in message

...
Al,
This code returns the state of paste, returns 1 for paste, otherwise

it
is
0.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox Application.CutCopyMode
End Sub

Unfortunately, this is an after-the fact response. What you might try

is
If Application.CutCopyMode = 1 then
*code to reformat the cells*
End If
The code could be nothing more than copying the format from cells

above
the paste range and pastespecial format.

--
sb
"MrAlMackay" wrote in message
...
Is it possible to intercept the paste function.

I've got formatting spreadsheet problems when people paste in data

from
their
own sheets / word.

What I'd like to be able to do is when they paste it actually

invokes
the
Paste
Special function and pastes as values only (therefore my own

formatting
will be
in place).

Appreciate any help that you can offer.

Many Thanks, Al Mackay ( )







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

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