Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New row/cell event detecting

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
I've never done anything with events, but im not even sure how to approach this, basically within my workarea, can VBA detect if a new row has been added, and if column C of that row, test whether AT&T, Sprint, or MCI was added. Once that is determined, how do i add the cell reference onto a formula at another location, so that if AT&T is added in that new row, and its cell ID is C15, then that will be added to the formula = C1+C5+C8+C15, but most importanly, the formula must stay as is, and not overwritten with the new answer, thanks!! this is a biggie, id really appreciate all the help i can get!
 
Since there is no event that fires when a row is inserted, you will need a different approach.

My first choice would be to use DSUM instead of modifying a formula, but I don't know whether the shape of your data will allow for that.

If you can't use DSUM, then you can process the Worksheet_Change event. The logic would be something like this (assume your formula is in X45):
1. If the target cell column is 3 (col "C") then
2. If the value is one of the special items then
3. If the formula in X45 doesn't include the target then
4. Modify the formula in X45.

You can use the .Precedents property of the X45 cell to good advantage when doing step 3. And of course you can use the technique I showed you in thread707-571328 when doing step 4.

 
ok thanks, i didnt know about the precedents property or dsum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top