PDA

View Full Version : macro triggered by row insertion



vbrookie
02-10-2009, 01:53 PM
Hi everybody,
I was hoping somebody could help me with this.

I need a macro to run automatically every time that a new line is
inserted on any of the sheet of a workbook (except one which is a summary).
I know it's possible to do it when opening or saving the spreadsheet but I have no idea how to do it when inserting a row (provided this is possible at all).

Apologies if it's a stupid question but I'm not very good at this!!
Many thanks in advance!

MaximS
02-10-2009, 06:11 PM
Can you explain what do you mean by word "inserted"?

A) Menu>>Insert>>Row

or

B) any data inserted into the first unused row

vbrookie
02-11-2009, 01:31 AM
hi thanks for replying
I meant insert row (your option A) however it wouldn't be a huge deal if both A and B triggered the macro. Thanks :-)

GTO
02-11-2009, 01:05 PM
Greetings,

Probably a better way, but while you cannot create an event for insert/delete columns per se, I was thinking of suggesting a workaround. When testing at home on Excel 2000 though, I was getting some bizarre results in trying to use sheet_change.

So... what would be the earliest version of Excel that you'd most likely be using this on?

Thanks,

Mark

vbrookie
02-14-2009, 04:30 AM
hi gto, i figured it out eventually

i just used worksheet_selectionchange to check whether the number of rows has increased

thanks anyway

GTO
02-14-2009, 11:22 AM
hi gto, i figured it out eventually

i just used worksheet_selectionchange to check whether the number of rows has increased

thanks anyway

Greetings and "Cool Amundo" as to getting it working. :thumb

Say, would you mind posting the solution you developed? Never know, it could help someone else.

Have a great weekend,

Mark