'runtime '-2147417848(90010108)' : Insert method of Range class failed while insert range
When only I execute the code below it is correct. But if I delete some blank rows in the worksheet and execute the code again, I will get
error runtime '-2147417848(90010108)' : Insert method of Range class failed.
where is the problem? This has troubled me for a long time, can anyone give me some help, thanks. Forgive my poor English.
Dim desWorkbook As Workbook
Set desWorkbook = Application.ThisWorkbook
Dim desWorksheet As Worksheet
Set desWorksheet = desWorkbook.Worksheets("A")
Dim srcWorkbook As Workbook
Set srcWorkbook = Workbooks.Open("D:\src.xlsx", False)
Dim srcWorksheet As Worksheet
Set srcWorksheet = srcWorkbook.Worksheets("A")
Dim srcRange As Range
Set srcRange = srcWorksheet.Range("A2:AQ100")
srcRange.Copy
desWorksheet.Range("3:3").Insert Shift:=xlDown 'error is here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
