Autofill cells when current cell value changes
Posted on 2014-09-15
I have a sheet where activities carried out by various people are mapped across segments of the day. This used to be just am and pm but we have now moved to 4 daily segments for each person (am1, am2, pm1 and pm2).
The codes that identify what each person is doing are quite long so, to make it easier for the admin staff, I would like them to be able to click an option that automatically replicates whatever is typed in a cell, across the other three cells under the persons name. (Most people work on the same project across all four segments - but not everybody, so I will probably build in a disable button for the exceptions).
I am assuming that a worksheet_change event can handle the autofill, but I'm not sure how.
The important thing is that it only autofills to the end of the appropriate set of 4 segments (i.e. that it doesn't overwrite data in other people's columns). For example, in the example below, if an activity code was entered/changed for Person A, am1 (let's assume it's cell A3), it would automatically replicate this content in cells B3, C3 and D3. However, if the activity code is entered for Person A pm1 (cell C3 in this example) it would only autofill cell D3 and not spill over into person B's columns.
A B C D E F G H
1 Person A Person B
2 am1 am2 pm1 pm2 am1 am2 pm1 pm2
3 Code Code etc.
Hope you can help.