How to Capture insert row event in Excel using VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to know how to capture the insert row event in an excel wroksheet
using VBA. If this is not possible, then is there any way to control the row
insert event?
 
There is no Row (or column) insert event.
One suggestion has been to watch for changes in the address of a named cell
somewhere outside your possible usedrange, in the SelectionChange event.

NickHK
 
Sri Ram napisal(a):
I need to know how to capture the insert row event in an excel wroksheet
using VBA. If this is not possible, then is there any way to control the row
insert event?

put in b1 formula rows("a1:a1000")
in c1 you put value of b1
and
Private Sub Worksheet_Calculate()
Dim chng
chng= Range("B1") - Range("C1")
If chng<> 0 Then
If chng> 0 Then
MsgBox "Row inserted"
Else
MsgBox "Row deleted"
End If
Application.EnableEvents = False
Range("C1") = Range("B1")
Application.EnableEvents = True
End If
End Sub


mcg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top