Excel VBA to run Macro in new row is Inserted

前端 未结 3 1077
迷失自我
迷失自我 2021-01-19 02:22

I am trying to have my spreadsheet automatically take the previous rows format and formulas when a new row is inserted.

I read where you can set up your sheet to a

3条回答
  •  醉话见心
    2021-01-19 03:10

    It looks like you are attached to the wrong event. You have attached your code to the "Worksheet_Change" event, but your code is also causing a change to the worksheet

    Cells(1, 2).Value = 10
    

    Which turns right around and invokes the "Worksheet_Change" event.

    As for the right event to attach to, it looks like there is no native event for "New Row Inserted".

    There is a discussion of this over on this page which might be an answer to your problem...

提交回复
热议问题