View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ozzer ozzer is offline
external usenet poster
 
Posts: 4
Default Controlling Row Inserts and Deletes Via Code

Hi all,

I have a problem which I hope someone can help with.

I have a workbook which has two sheets.
Sheet one is used to list the assets and Liabilities for a person.
Sheet two is essentialy a copy of the details on one with a couple of
extra columns, with forumula linking back to sheet one. This sheet is
used to detmine a distribution of the assest. (the workbook is used to
calculate asset distribution for a divorce :(

The problem is is a user deletes a row from sheet one then on sheet 2
it will show a #REF error

Sheet one example

A1 contains the words House
B1 Contains the amount $250000
A2 Contains the words Car
B2 Contains the amount $40000


Sheet 2
A1 contains formula =sheet1!A1
B1 Contains formula = Sheet1!b1-c1-d1
A2 contains formula = Sheet1!A2
B2 contains formula = Sheet1!b2-c2-d2

What I want to do is have it so if a user wants to enter a new row on
sheet one between the current bits of data a new row will also be
entered into sheet two and the formula would also be entered.
Then if a user deletes a row from sheet one that same row on sheet two
must also be delted.
I was thiking I might use a custom toolbar for these commands. So a
user just has to click on sheet one where they want the new row (or the
row to delete) then click a button on the toolbar to inert or delete



Any assistance would be greatly appreciatred. I have tried this with a
macro but cant seem to get it to work.

Many thanks in advance

David