Insert Rows in an Existing XLS

F

Florence

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!
 
B

Barry Gilbert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top