I'd appreciate any help on this problem that anyone could offer.
I recorded a macro which contains only one line to paste values from one
range of cells into another range. The cells to copy are already selected
(i.e. Cntl-C) and the destination range is also selected BEFORE invoking the
macro.
The code is very simple and looks like this :
Sub Test()
'
' Test Macro
'
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub
and the Runtime Error 1004 occurs right at the Selection.PasteSpecial ....
line.
This has always worked in the past and from one day to the next it has
stopped functioning. Does anyone have a clue why ??
Thanks in advance.
Phil
Maybe there's nothing to paste???
I'd add line:
if application.cutcopymode = false then
msgbox quot;nothing to pastequot;
exit sub
end ifThere's lots of things that cause the clipboard to empty. Maybe you did
something or maybe an event macro fired???
Phil Davis wrote:
gt;
gt; I'd appreciate any help on this problem that anyone could offer.
gt;
gt; I recorded a macro which contains only one line to paste values from one
gt; range of cells into another range. The cells to copy are already selected
gt; (i.e. Cntl-C) and the destination range is also selected BEFORE invoking the
gt; macro.
gt;
gt; The code is very simple and looks like this :
gt;
gt; Sub Test()
gt; '
gt; ' Test Macro
gt;
gt; '
gt; Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
gt; SkipBlanks _
gt; :=False, Transpose:=False
gt; End Sub
gt;
gt; and the Runtime Error 1004 occurs right at the Selection.PasteSpecial ....
gt; line.
gt;
gt; This has always worked in the past and from one day to the next it has
gt; stopped functioning. Does anyone have a clue why ??
gt;
gt; Thanks in advance.
gt;
gt; Phil
--
Dave Peterson
There is a small trick required to make your macro run properly.
If you call your macro thru menu commands, the clipboard will be emptied of
copied ranges and the paste will fail.
Assign a short-cut key to the macro and use it and the paste should not fail.
--
Gary''s Studentquot;Phil Davisquot; wrote:
gt; I'd appreciate any help on this problem that anyone could offer.
gt;
gt; I recorded a macro which contains only one line to paste values from one
gt; range of cells into another range. The cells to copy are already selected
gt; (i.e. Cntl-C) and the destination range is also selected BEFORE invoking the
gt; macro.
gt;
gt; The code is very simple and looks like this :
gt;
gt; Sub Test()
gt; '
gt; ' Test Macro
gt;
gt; '
gt; Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
gt; SkipBlanks _
gt; :=False, Transpose:=False
gt; End Sub
gt;
gt; and the Runtime Error 1004 occurs right at the Selection.PasteSpecial ....
gt; line.
gt;
gt; This has always worked in the past and from one day to the next it has
gt; stopped functioning. Does anyone have a clue why ??
gt;
gt; Thanks in advance.
gt;
gt; Phil
- Sep 23 Tue 2008 20:46
Runtime Error 1004 when trying to PasteSpecial
close
全站熱搜
留言列表
發表留言
留言列表

