See who's quickest at solving this
Thanks Bernie
You have pointed me in the right direction. I was wrong about a few things I put down in my initial request yesterday.
Column A & B has 564 emplyees and there are 447 that need to be compared from columns C &
I initally thought that all in Columns C & D would be in A & B somewhere. I was wrong. So, I also need the ability to insert blank cells in certain rows in column A & B. (Employee ID's are sorted in Ascending order
This is the code I slightly ammended from your reply to try and resolve this
There is still aproblem I need to resolve which I will explain after the code
Sub Macro(
Dim myCell As Rang
Dim row As Lon
Range("A:B").Sort key1:=Range("A1"), order1:=xlAscending, header:=xlN
Range("C:D").Sort key1:=Range("C1"), order1:=xlAscending, header:=xlN
For row = 1 To Application.Count(Range("A:A")
If Cells(row, 3).Value < Cells(row, 1).Value And Cells(row, 1).Value < Cells(row, 3).Value The
Cells(row, 3).Resize(1, 2).Insert Shift:=xlDow
Els
If Cells(row, 3).Value < Cells(row, 1).Value And Cells(row, 1).Value Cells(row, 3).Value The
Cells(row, 1).Resize(1, 2).Insert Shift:=xlDow
End I
End I
Next ro
End Su
My problem is, once this reaches row 556 the program seems to stop doing its thing and the remainder of the employees are not lined up. Bare in mind that due to blank spaces being inserted, column A employees are shifting below row 556
How can I get the program to carry on lining up the employees below the original last employee row
Does this make sense
Thanks in advanc
Malcolm Davidson
|