PDA

View Full Version : Solved: Excel 2003/2007 - Need to trigger the change event if new row is inserted, or deleted



frank_m
12-16-2010, 10:27 AM
Hi,

With an .xls 2003 file that I also run sometimes with Excel 2007, I need to trigger the sheets change event if a row is inserted, or deleted

Thanks for your assistance.

Bob Phillips
12-16-2010, 11:22 AM
You could try something like this for insert

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Columns.Count = Me.Columns.Count And Application.CountIf(Target, "") = Me.Columns.Count Then

Debug.Print Target.Address
End If
End Sub

Delete is a lot harder.

frank_m
12-16-2010, 11:37 AM
Hi xld.. Thanks so much, works like a charm.

The delete row I really do not need currently but may need later on. If I get to needing that in the future I will post back some time down the road.

* On the other hand, the insert detection I needed desperately, and because of you I am now calm and relaxed once more. :beerchug:
(even though I do not drink the icon above felt appropriate, (hee-hee) :yes

Bob Phillips
12-16-2010, 12:31 PM
You don't drink! I don't think I am going to respond to any more of your posts :devil2:

frank_m
12-16-2010, 03:36 PM
Yes it's true that i don't drink, but on the flip side, people have been known (from time to time), (after they have met me and treated me well), to discover a case of beer on their door step, from an unknown source, ha-ha :*) :whip

Bob Phillips
12-17-2010, 02:37 AM
Well, I drink Scottish malt whisky, so a case of that would be very well received :p

frank_m
12-17-2010, 03:08 AM
hmmmmm :bow: if I were to receive an email at tboltfrank@gmail.com, that descrides a drop off location, I might just surprise you one day. Also be sure to include some tourist recommendations for a few must see sights in your area, since I will want to have more than just that delivery as a reason to travel there :yes