Hi all
I was hoping someone can help me with some VBA to achieve what I am looking for.
Basically on Sheet 1 the users enters a list of names in Column A and then dates of employment in Columns B to C. So in the below example Jack was employed from 01/01/1980 until 31/12/1985.
Sheet 1: All managers
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jack[/TD]
[TD]01/01/1980[/TD]
[TD]31/12/1985[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]John[/TD]
[TD]01/01/1986[/TD]
[TD]31/12/1995[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Jill[/TD]
[TD]01/01/1996[/TD]
[TD]31/12/1998[/TD]
[/TR]
</tbody>[/TABLE]
I need some VBA which when run will achieve the following based upon the data entered on Sheet 1:
I have set out what should be populated on Sheet 2 and 3 below based on the current example.
Note that John’s employment is from 01/01/1986 – 31/12/1995 which spans both pre and post 1990. In this circumstance the entry should be automatically split at 31/12/1989 on Sheet 2 and the remainder of the period should be populated on Sheet 3 as beginning from 01/01/1990 as per the below example.
Sheet 2: Before 1990
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jack[/TD]
[TD]01/01/1980[/TD]
[TD]31/12/1985[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]John[/TD]
[TD]01/01/1986[/TD]
[TD]31/12/1989[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 3: After 1990
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John[/TD]
[TD]01/01/1990[/TD]
[TD]31/12/1995[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Jill[/TD]
[TD]01/01/1996[/TD]
[TD]31/12/1998[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Points to note:
1. The number of managers on Sheet 1 could vary between 1 – 30.
2. The dates will never overlap as there can only be one “manager” for one period.
Thank you for your help!
R
I was hoping someone can help me with some VBA to achieve what I am looking for.
Basically on Sheet 1 the users enters a list of names in Column A and then dates of employment in Columns B to C. So in the below example Jack was employed from 01/01/1980 until 31/12/1985.
Sheet 1: All managers
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jack[/TD]
[TD]01/01/1980[/TD]
[TD]31/12/1985[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]John[/TD]
[TD]01/01/1986[/TD]
[TD]31/12/1995[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Jill[/TD]
[TD]01/01/1996[/TD]
[TD]31/12/1998[/TD]
[/TR]
</tbody>[/TABLE]
I need some VBA which when run will achieve the following based upon the data entered on Sheet 1:
- Populate Sheet 2 with managers before 01/01/1990
- Populated Sheet 3 with managers after 01/01/1990
I have set out what should be populated on Sheet 2 and 3 below based on the current example.
Note that John’s employment is from 01/01/1986 – 31/12/1995 which spans both pre and post 1990. In this circumstance the entry should be automatically split at 31/12/1989 on Sheet 2 and the remainder of the period should be populated on Sheet 3 as beginning from 01/01/1990 as per the below example.
Sheet 2: Before 1990
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jack[/TD]
[TD]01/01/1980[/TD]
[TD]31/12/1985[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]John[/TD]
[TD]01/01/1986[/TD]
[TD]31/12/1989[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Sheet 3: After 1990
[TABLE="class: grid, width: 284"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Manager[/TD]
[TD]Date From[/TD]
[TD]Date To[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John[/TD]
[TD]01/01/1990[/TD]
[TD]31/12/1995[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Jill[/TD]
[TD]01/01/1996[/TD]
[TD]31/12/1998[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Points to note:
1. The number of managers on Sheet 1 could vary between 1 – 30.
2. The dates will never overlap as there can only be one “manager” for one period.
Thank you for your help!
R
Last edited: