Code: Select all
---------------------------
&Test Script.ahk
---------------------------
Error: 0x800A03EC -
Source: Microsoft Excel
Description: Unable to get the Insert property of the Range class
HelpFile: xlmain11.chm
HelpContext: 0
Specifically: Insert
Line#
316: Return
320: Loop,250
321: SendInput,{Del}{Backspace}
322: SendInput,=$N:$X
323: Return
327: xl := ComObjActive("Excel.Application")
328: xl.Range("M1514:X1514").Select
---> 329: xl.Selection.Insert("xlShiftDown")
330: xl.Range("M1522:X1522").Select
331: xl.Selection.ClearContents
332: xl.Range("M1530:X1530").Select
333: xl.Selection.ClearContents
334: xl.Range("M1538:X1538").Select
335: xl.Selection.Delete("xlShiftUp")
336: xl := ""
Continue running the script?
---------------------------
Yes No
---------------------------
I'm at a loss as to how I should be doing this. Line 328 is working properly. I have also tried combining 328 and 329 by using xl.Range("M1514:X1514").Insert("xlDown") (didn't yet learn of the xlShiftDown document as named in the first link, haven't yet tried xlShiftDown here, but assume it won't work based on...) to no avail.
VBA Code that I have from recording the macro; you'll notice I'm trying to apply this to a different range.
Code: Select all
Sub Macro1()
'
' Macro1 Macro
'
'
Range("M1442:X1442").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("M1450:X1450").Select
Selection.ClearContents
Range("M1458:X1458").Select
Selection.ClearContents
Range("M1466:X1466").Select
Selection.Delete Shift:=xlUp
End Sub