+ Reply to Thread
Results 1 to 3 of 3

Help w/Insert

  1. #1
    Registered User
    Join Date
    06-20-2005
    Posts
    15

    Help w/Insert

    How can I recognize, in VBA, when a cell and/or a line is inserted in Excel?

    Thank you

  2. #2
    abcd
    Guest

    Re: Help w/Insert

    I think there's no special event for this purpose. But you can detect
    with simulating a special "row counter"
    if you can, in any column of your last row (after the last used row)
    insert a cell with the formula "=ROW(A12)"
    (if the cell is in the cell A12, this mean the line 12 is after the
    last used one) Give a special name to that cell (example: "last_row")

    Since each time you insert a line, the value of this special cell will
    change, then a calculate event will occure !
    Wone !

    in the sheet events:

    Dim old_last_row As Double

    Private Sub Worksheet_Calculate()
    with Me.Range("last_row")
    If .Value <> old_last_row Then
    'nb of rows changed
    old_last_row = .Value
    End If
    end with
    End Sub

    there are for sure many ways to do this, but you need to detect this
    event from another one, since there's no special event launched when you
    insert a line.

  3. #3
    Registered User
    Join Date
    06-20-2005
    Posts
    15
    abcd,

    I’ve implemented your solutions and it works fine.

    Thanks,

    Bird

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1