ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Capture insert row event in Excel using VBA (https://www.excelbanter.com/excel-programming/369706-how-capture-insert-row-event-excel-using-vba.html)

Sri Ram[_2_]

How to Capture insert row event in Excel using VBA
 
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?

NickHK

How to Capture insert row event in Excel using VBA
 
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" wrote in message
...
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?




mcg

How to Capture insert row event in Excel using VBA
 

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



All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com