ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste special (https://www.excelbanter.com/excel-programming/384903-paste-special.html)

Heine

Paste special
 
Hello everybody

I want to create a paste special button. My VBA is not as strong,
though.

ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

I thought this little bit of code would do the trick. But it fails.

Any ideas?


joel

Paste special
 
this code copies only one line. I had to change .select to .copy to get it
to work. I added the .END to put the data in the first empty row and added a
..OFFSET so the last line of data was not over writen.

Private Sub CommandButton1_Click()
ActiveCell.Copy

Selection.End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, skipBlanks:=False, Transpose:=False

End Sub


"Heine" wrote:

Hello everybody

I want to create a paste special button. My VBA is not as strong,
though.

ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

I thought this little bit of code would do the trick. But it fails.

Any ideas?



Heine

Paste special
 
Hi again

thanks for the reply.
Cannot get it to work though. What I want is this:

I copy a cell - activate the cell in which I want to paste data - and
then run the macro to paste as values.

The above formula return an error.

Any thoughts?

/Heine


Bob Flanagan

Paste special
 
You would be better off just adding the paste special values button
available in View, Toolbars, Customize, Commands. If you do paste special
via a macro, you can not undo. If you the existing button, you can undo.

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Heine" wrote in message
ups.com...
Hello everybody

I want to create a paste special button. My VBA is not as strong,
though.

ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

I thought this little bit of code would do the trick. But it fails.

Any ideas?




Tom Ogilvy

Paste special
 
Bob gave you the best advice. The reason you are having problems is what Bob
alluded to, but it is worse than he said. When you run the macro, the
clipboard is cleared, so you can't do the paste much less undo anything.

--
Regards,
Tom Ogilvy


"Heine" wrote:

Hi again

thanks for the reply.
Cannot get it to work though. What I want is this:

I copy a cell - activate the cell in which I want to paste data - and
then run the macro to paste as values.

The above formula return an error.

Any thoughts?

/Heine



SteveK

Paste special
 
I have done this in a macro that is assciated with a hot key cntl-a that I
keep in my personal.xls. I works great. I use it everyday. Just delete the a
ActiveCell.Select line. You don't need it. Do the copy, then click on the
cell where you want to paste and hit cntl-a.

SteveK

"Heine" wrote:

Hello everybody

I want to create a paste special button. My VBA is not as strong,
though.

ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

I thought this little bit of code would do the trick. But it fails.

Any ideas?




All times are GMT +1. The time now is 04:03 PM.

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