J
J. Trucking
Hello,
I have imported a whole bunch of data into Excel. It is employee data
and each entry will have the employees name in Column A. What I want
to do is make the cell contents of any duplicate entry blank so that I
end up with a whole bunch of entries for each employee with their name
only appearing in the first entry. If possible, I would like to then
merge the empty cells with the first one. For example, I currently
have:
John Doe
John Doe
John Doe
John Doe
Jane Smith
Jane Smith
Jane Smith
Jane Smith
Jane Smith
I would like to clear the contents of the 2nd, 3rd, and 4th "John Doe"
leaving only the first. I would then like to merge cells "A1:A4" to
group all of the John Doe entries. I could then like to do all of the
same with the Jane Doe Entries. I currently have some code but it
seems to hang up (A6 is the first employee name)
Do Until Range("A6").Value <> Range("A7").Value
Range("A6").End(xlDown).Select
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Value = ""
End If
Range("A6").Select
Loop
I have noticed that when I am in Excel, I can select all of the "John
Doe" names, right click, and Merge the Cells. It just gives me a
warning that the cells contain different values (I am referencing the
values from a different sheet). Maybe this is an easier way of dooing
it. Would there be a way I could select all similar entries and merge
them without seeing the warning message?
Thanks in advance,
John
I have imported a whole bunch of data into Excel. It is employee data
and each entry will have the employees name in Column A. What I want
to do is make the cell contents of any duplicate entry blank so that I
end up with a whole bunch of entries for each employee with their name
only appearing in the first entry. If possible, I would like to then
merge the empty cells with the first one. For example, I currently
have:
John Doe
John Doe
John Doe
John Doe
Jane Smith
Jane Smith
Jane Smith
Jane Smith
Jane Smith
I would like to clear the contents of the 2nd, 3rd, and 4th "John Doe"
leaving only the first. I would then like to merge cells "A1:A4" to
group all of the John Doe entries. I could then like to do all of the
same with the Jane Doe Entries. I currently have some code but it
seems to hang up (A6 is the first employee name)
Do Until Range("A6").Value <> Range("A7").Value
Range("A6").End(xlDown).Select
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Value = ""
End If
Range("A6").Select
Loop
I have noticed that when I am in Excel, I can select all of the "John
Doe" names, right click, and Merge the Cells. It just gives me a
warning that the cells contain different values (I am referencing the
values from a different sheet). Maybe this is an easier way of dooing
it. Would there be a way I could select all similar entries and merge
them without seeing the warning message?
Thanks in advance,
John