![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com