Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default 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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default 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?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
Cut and Paste using Macro gives paste special method error Lourens Pentz Excel Programming 3 November 21st 04 10:42 PM
How do I capture user paste action and convert to Paste Special DonC Excel Programming 0 November 19th 04 01:43 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"