Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Please help with PasteSpecial programming

Hi,

I have the following code working fine:

Sub Macro(1)
Selection.Copy
Range("A5").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

The problem with this code is the destination cell is hardcoded. I'd
like to be able to select any cell, copy it, select any other cell
(using the mouse to navigate) and PasteSpecial into that cell.

When I manually select a cell, copy and run:

Sub Macro(2)
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

by itself, I get the following error message:

Run-time error '1004':

PasteSpecial method of Range class failed.

How do I get Macro(1) to work?

Thanks,

Peter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Please help with PasteSpecial programming

Thanks for your reply. Yes, I found the Paste Value button. Is there a
way to get that to appear in the pop-up menu when I right-click a
cell?

Peter

"Don Guillett" wrote in message ...
Then wouldn't it be easier to do just that using the built in copy button
and the built in paste button. You may have to add the paste button by
customizing your toolbar. It's the one that has a little 12 in the box in
the edit.

--
Don Guillett
SalesAid Software

"Peter" wrote in message
om...
Hi,

I have the following code working fine:

Sub Macro(1)
Selection.Copy
Range("A5").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

The problem with this code is the destination cell is hardcoded. I'd
like to be able to select any cell, copy it, select any other cell
(using the mouse to navigate) and PasteSpecial into that cell.

When I manually select a cell, copy and run:

Sub Macro(2)
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

by itself, I get the following error message:

Run-time error '1004':

PasteSpecial method of Range class failed.

How do I get Macro(1) to work?

Thanks,

Peter

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Please help with PasteSpecial programming

How do I get Macro(1) to work?
Do you mean Macro(2)?

Try this (Excel sometimes requires declaring and setting a reference):

Sub Macro(2)
dim rng as Range
set rng = ActiveCell

rng.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:= False, Transpose:=False
End Sub
--
Regards,
Bill


"Peter" wrote in message
om...
Hi,

I have the following code working fine:

Sub Macro(1)
Selection.Copy
Range("A5").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

The problem with this code is the destination cell is hardcoded. I'd
like to be able to select any cell, copy it, select any other cell
(using the mouse to navigate) and PasteSpecial into that cell.

When I manually select a cell, copy and run:

Sub Macro(2)
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

by itself, I get the following error message:

Run-time error '1004':

PasteSpecial method of Range class failed.

How do I get Macro(1) to work?

Thanks,

Peter



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
pastespecial Claude Excel Programming 2 February 24th 04 01:21 PM
pastespecial in vba cornishbloke[_13_] Excel Programming 7 December 31st 03 01:02 PM
PasteSpecial macro CG Rosén Excel Programming 3 December 22nd 03 01:14 AM
vba pastespecial joao Excel Programming 2 November 14th 03 03:31 PM
pastespecial billQ Excel Programming 2 July 29th 03 11:39 PM


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

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

About Us

"It's about Microsoft Excel"