Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime Error 1004 | Excel Programming | |||
Another runtime 1004 error | Excel Discussion (Misc queries) | |||
Runtime error 1004 | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
What is RunTime Error '1004'? | Excel Programming |