Dec 01 2020 08:21 PM
Dec 01 2020 08:21 PM
Hi, I have worksheet B that copies cell data from worksheet A. Every time I insert a row in sheet A, sheet B is updated and then the data from the newly inserted row in sheet A doesn't show up in sheet B. How can I make some sort of an absolute cell reference in sheet B that won't update when the row is inserted in sheet A?
Dec 02 2020 05:03 PM
@Faraz Shaikh Thanks for looking into this. I attached the sheet. Maybe another way of looking at it is to insert a row in the 'contact history' sheet whenever I add a new contact in 'person data'.
The problem is that when I add a new person (row) in 'person data' , I need to manually insert a row and update the 'contact history' sheet to include that person. How can I make this happen automatically?
Thanks for your help.
Dec 02 2020 05:46 PM
Dec 02 2020 06:12 PM
@JMB17 Thanks. That works for the cells where data is being directly copied over.
But somehow I would like to insert the row all across the 'contact history' sheet. Is it possible to insert a row on the second sheet when a row is inserted on the first sheet?
Dec 02 2020 11:33 PM - edited Dec 02 2020 11:34 PM
I see what you mean. The remaining fields are inputs and won't match the correct family.
For a formula solution, you would probably need to set up a column on the contact log for the family ID. The user could input the family ID and then you could use a vlookup formula to pull in the adult/children names from your names table.
Otherwise, it will require vba. I would name the table containing the family names as well as the adult and children columns so vba can easily find those ranges. Also, I added a gray border at the bottom as a visual cue that all rows must be inserted at or above that border row. When the workbook opens, it would need to capture the number of rows of the table. Then, set up a worksheet change event handler to compare the current row count to the saved row count and determine if rows were inserted. Then, insert rows at the same location in the contact worksheet and link the adult/children cells back to the name table.
If it were me, I would first look to use ID numbers and lookup formulas. But, I attached a file using vba to insert the rows if you want to look at it. If the user selects a non-contiguous area when inserting rows, then it's not as straightforward to insert the rows in the contact worksheet because excel apparently starts at the bottom and passes one area at a time (so, there is a row offset calculation to handle that situation).