Paste Problem

  • Thread starter Thread starter ajocius
  • Start date Start date
A

ajocius

Group,
Below is an excerpt from my VBA project. At home this runs quite
fine using Excel 2002. But here at work I get the following error
message. What must I do to resolve this error.

Error Message: Runtime Error 1004: PasteSpecial method of range class
failed


Line before, line and line after below.


'*****************************
wb3.Activate

Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Application.CutCopyMode = False

'*****************************

The second line above is highlighted when I select Debug from the error
box.


Tony
 
Make sure that the selection is what you want. Before pasting try:

Dim s As String
s = Selection.Address
MsgBox (s)

Do this both at home and at work.
 
This is just a guess, but you may need a line continuation character (space
underscore.) Since you refer to line as a separate line, I suspect this may
be the case.
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Hi,


This error generally comes when you don't copy any thing before pasting.
You must copy the range (Data) bfore pasting it by using "pastespecial"
command.


Ankit,
India
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top