Using MS Access VBA to insert a row into an Excel worksheet, between existing rows without replacing data.

Anonymous
2015-09-09T17:55:45+00:00

I need help with some simple syntax. Most of what i find is more complex than i require and i cannot seem to be able to figure out how, within my VBA procedure to be able to insert a new blank row directly after the existing 2nd row, but without replacing it. No matter what i try, it successfully inserts the row, but it replaces the exiting data!  My most recent attempt:

 xlWSh.Range("2:2").Select

ActiveCell.Offset(1).EntireRow.Insert

have also tried simply:

 xlWSh.Range("2:2").Select

ActiveCell.EntireRow.Insert

Thank you for your help!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2015-09-09T20:44:15+00:00

    Thank you again - I really appreciate everyone's help. Since it works for you, then I am sure that I must be missing something elsewhere in my code. But I have it working now. I did wonder, however, if you would recommend using the one insert line (xlWSh.Rows(2).EntireRow.Insert) over the little group of "WITH" lines (they both are working fine).

    0 comments No comments