Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Runtime error 1004

Can anyone help me as to why I get a run time error 1004 - Insert method of
Range Class failed
when this bit of code reaches the "Selection" line?

Sub compare()

Row = 1
Do
If (Cells(Row, 1) < Cells(Row, 4)) Then
Cells(Row, 4).Select
Selection.Insert shift:=x1down
Else
Row = Row + 1
End If
Loop Until Row = 20

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime error 1004


hi

change shift:=x1Down to shift:=xlDown

regards yngve


--
yngve
------------------------------------------------------------------------
yngve's Profile: http://www.excelforum.com/member.php...o&userid=31943
View this thread: http://www.excelforum.com/showthread...hreadid=518420

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Runtime error 1004

Looks like it should be "xlDown" instead of "x1Down" -- use an "l" instead of
a "1"

"Zippy" wrote:

Can anyone help me as to why I get a run time error 1004 - Insert method of
Range Class failed
when this bit of code reaches the "Selection" line?

Sub compare()

Row = 1
Do
If (Cells(Row, 1) < Cells(Row, 4)) Then
Cells(Row, 4).Select
Selection.Insert shift:=x1down
Else
Row = Row + 1
End If
Loop Until Row = 20

End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Runtime error 1004

Thanks guys!! I've looked at this for so long and didn't spot that!!

Zippy

"Joel Berry" wrote in message
...
Looks like it should be "xlDown" instead of "x1Down" -- use an "l" instead

of
a "1"

"Zippy" wrote:

Can anyone help me as to why I get a run time error 1004 - Insert method

of
Range Class failed
when this bit of code reaches the "Selection" line?

Sub compare()

Row = 1
Do
If (Cells(Row, 1) < Cells(Row, 4)) Then
Cells(Row, 4).Select
Selection.Insert shift:=x1down
Else
Row = Row + 1
End If
Loop Until Row = 20

End Sub





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 1004 Lizz45ie[_10_] Excel Programming 4 November 8th 05 10:51 PM
Another runtime 1004 error [email protected] Excel Discussion (Misc queries) 2 September 17th 05 09:21 AM
Runtime error 1004 Daniel Excel Programming 2 July 19th 05 04:37 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
What is RunTime Error '1004'? Ed Excel Programming 3 November 18th 04 07:09 PM


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