PC Review


Reply
Thread Tools Rate Thread

Detecting Table Change

 
 
Steve Haack
Guest
Posts: n/a
 
      14th Jan 2009
All,
I am using Excel 2007. I have a range on a sheet that I have defined as a
Table using the "Format As Table" button on the Styles tab of the ribbon.

Using Code, I would like to detect when someone has inserted a new row into
the table, so that I can go off and do some other things.

Can anyone tell me how to detect that insertion?

Thanks,
Steve
 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      14th Jan 2009

I didn't just run off and test this, but I would think Worksheet_Change
would cover it. If any formulas reference a table column,
Worksheet_Calculate will also do the trick.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Steve Haack" <(E-Mail Removed)> wrote in message
news:B3910EB7-948E-48EB-B65C-(E-Mail Removed)...
> All,
> I am using Excel 2007. I have a range on a sheet that I have defined as a
> Table using the "Format As Table" button on the Styles tab of the ribbon.
>
> Using Code, I would like to detect when someone has inserted a new row
> into
> the table, so that I can go off and do some other things.
>
> Can anyone tell me how to detect that insertion?
>
> Thanks,
> Steve



 
Reply With Quote
 
Steve Haack
Guest
Posts: n/a
 
      14th Jan 2009
But, Wouldn't that tell me when ANYTHING on the sheet changes? only want to
know when the table has changed. How would I filter down to that?

Steve

"Jon Peltier" wrote:

> I didn't just run off and test this, but I would think Worksheet_Change
> would cover it. If any formulas reference a table column,
> Worksheet_Calculate will also do the trick.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Peltier Technical Services, Inc.
> http://PeltierTech.com/WordPress/
> _______
>
>
> "Steve Haack" <(E-Mail Removed)> wrote in message
> news:B3910EB7-948E-48EB-B65C-(E-Mail Removed)...
> > All,
> > I am using Excel 2007. I have a range on a sheet that I have defined as a
> > Table using the "Format As Table" button on the Styles tab of the ribbon.
> >
> > Using Code, I would like to detect when someone has inserted a new row
> > into
> > the table, so that I can go off and do some other things.
> >
> > Can anyone tell me how to detect that insertion?
> >
> > Thanks,
> > Steve

>
>
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      14th Jan 2009
You check for which cells changed. The range that triggers the event is
called Target. A table is called a listobject. This is the basic code you
would use:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.ListObjects(1).DataBodyRange) Is Nothing Then
MsgBox "changed the table"
End If
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______

"Steve Haack" <(E-Mail Removed)> wrote in message
news:11668F82-3E67-4C57-AA72-(E-Mail Removed)...
> But, Wouldn't that tell me when ANYTHING on the sheet changes? only want
> to
> know when the table has changed. How would I filter down to that?
>
> Steve
>
> "Jon Peltier" wrote:
>
>> I didn't just run off and test this, but I would think Worksheet_Change
>> would cover it. If any formulas reference a table column,
>> Worksheet_Calculate will also do the trick.
>>
>> - Jon
>> -------
>> Jon Peltier, Microsoft Excel MVP
>> Peltier Technical Services, Inc.
>> http://PeltierTech.com/WordPress/
>> _______
>>
>>
>> "Steve Haack" <(E-Mail Removed)> wrote in message
>> news:B3910EB7-948E-48EB-B65C-(E-Mail Removed)...
>> > All,
>> > I am using Excel 2007. I have a range on a sheet that I have defined as
>> > a
>> > Table using the "Format As Table" button on the Styles tab of the
>> > ribbon.
>> >
>> > Using Code, I would like to detect when someone has inserted a new row
>> > into
>> > the table, so that I can go off and do some other things.
>> >
>> > Can anyone tell me how to detect that insertion?
>> >
>> > Thanks,
>> > Steve

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting a change in a cell Brad Stone Microsoft Excel Programming 4 14th Mar 2008 10:25 PM
Detecting and acting on End of Table JHB Microsoft Access 1 7th Nov 2007 03:02 PM
Detecting Changes in Database Table from app Dave.Womer@gmail.com Microsoft ADO .NET 1 10th Aug 2007 02:04 PM
Detecting Table Locks? jfer Microsoft ADO .NET 13 9th Jan 2007 06:09 AM
detecting change A Benn Microsoft Excel Discussion 1 30th Sep 2004 12:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.