THIS IS THE PROJECT:

SHEET1
HTML Code: 
SHEET2
HTML Code: 

The Location ID's is to be the same all the time (A.1.1, A.2.1, etc, each in it's fixed cell) as set up in Sheet 1. These Location ID's is also listed in the last column of Sheet 2, in order to use a list Function in sheet 2.

The Item numbers in column A Sheet 2 ( 40032, 40033, 40045 etc) will be changed (old ones deleted and new ones adding). This the users will do by deleting or inserting the entire row in Sheet 2.

------------------------------------------------

What I want the code to do:

1.
New Location ID registrations in Sheet 2 shall look in the same row, column A and register this unik Item number in sheet 1 in the first free cell MAT1, MAT2, MAT3 or MAT4 under the Location ID. Also the date of the last registration in these cells must register in the DATE cell. When the cells MAT1, MAT2, MAT3 and MAT4 is occupied, no new registrations can be made in this Location ID.

2.
Also when the Location ID entries in sheet 2 is deleted, the system must behave as described over but now delete the unike Item number in Sheet 1, without changing the DATE. I guess that in order to handle this, when an Item number and the entire row is to be deleted (as described in "THIS IS THE PROJECT"), the system must not accept this deletion except the entire row to the right of the Itemnumber is empty.

3.
When a user is trying to change directly the Location ID registration in a cell in sheet 2, the system must prompt the user to first delete the former Location ID-This for safety. The deletion of the Item number must occur without changing the DATE.
Then the user can register the Item number under the new Location ID with a change in the allocated DATE cell in Sheet 1.
-----------------------------------------------------------

So no deletions is to be registered in the DATE cell, only the DATE of the registration of new Item numbers.

Is it possible to make a code do this ?