Consulting

Results 1 to 6 of 6

Thread: macro triggered by row insertion

  1. #1

    macro triggered by row insertion

    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!

  2. #2
    VBAX Mentor MaximS's Avatar
    Joined
    Sep 2008
    Location
    Stoke-On-Trent
    Posts
    360
    Location
    Can you explain what do you mean by word "inserted"?

    A) Menu>>Insert>>Row

    or

    B) any data inserted into the first unused row

  3. #3
    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 :-)

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    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

  5. #5
    hi gto, i figured it out eventually

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

    thanks anyway

  6. #6
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Quote Originally Posted by vbrookie
    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.

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

    Have a great weekend,

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •