Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Phil Davis
 
Posts: n/a
Default Runtime Error 1004 when trying to PasteSpecial

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Runtime Error 1004 when trying to PasteSpecial

Maybe there's nothing to paste???

I'd add line:

if application.cutcopymode = false then
msgbox "nothing to paste"
exit sub
end if


There's lots of things that cause the clipboard to empty. Maybe you did
something or maybe an event macro fired???

Phil Davis wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Runtime Error 1004 when trying to PasteSpecial

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 Student


"Phil Davis" wrote:

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

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
Runtime error Anthony Excel Discussion (Misc queries) 1 October 9th 05 01:28 AM
runtime error '6' overflow don Setting up and Configuration of Excel 1 July 26th 05 02:52 AM
Runtime Error '1004' [email protected] Excel Discussion (Misc queries) 2 July 18th 05 06:10 AM
Excel 2003 Help Runtime Error Weezay Excel Discussion (Misc queries) 1 January 27th 05 06:57 PM
Why do I get the runtime error message430 when I start my compute. Thorcat Setting up and Configuration of Excel 1 December 2nd 04 07:15 PM


All times are GMT +1. The time now is 11:09 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"