Insert Rows in an Existing XLS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I want to insert rows in an existing Excel file after the 10th row with
contents pre-defined driven by Access module:

Dim objSht As Excel.Worksheet
…
With objSht
..Rows("10:10").Select
..Rows.Insert (xlShiftDown)
End With

Then the Access will return an error like this:
“Run-time error ‘1004’
To prevent possible loss of data, Mocrosoft Office Excel cannot shift
nonblank cells off the worksheet …â€

However, I am able to insert rows manually inside the Excel.

Do you have any idea if I can ignore this error?

Much thanks!
 
Florence,
Excel seems to think you have something in the last row. In Excel, find the
last row that contains data. Select everything from the next row down to the
bottom and delete the rows. This will clear any phantom stuff that might be
saved in another row (especially 65,536). Save the file and try again.

Barry
 
Back
Top