Not sure what I need to do to have permission to post attachments so I may have to do this in the body of the message.
I am using code such as the following:
where the spreadsheet contains data in columns A and B like so:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove
[/TD]
[/TR]
</tbody>[/TABLE]
The problem is that when I run the code I end up with this:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove[/TD]
[/TR]
</tbody>[/TABLE]
(the real data is more complex and has blanks instead of "remove")
But when I invoke the Remove Duplicates from the Data Menu and uncheck Column B I get what I want - like this:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
</tbody>[/TABLE]
So not sure why the VBA behavior does not match the GUI behavior.
It does seem to be an issue only with Office for Mac - I am currently using Excel for Mac 2011 version 14.4.3 (140616) and it does not have this issue with Excel for Windows 2007 version 12.0.6683.5002 SP3 MSO 12.0.6683.5000
Also tried it on Windows Office 2010 and it works as intend.
I tried it on three different Macs - all with 14.4.3 same build without success. I don't currently have any other versions loaded up to test it on.
I develop on Mac but need to maintain compatibility with both Mac and Windows versions as I have users on both.
If I cannot get this working I may have to resort to much more complex looping type code.
I have a sample workbook that I can upload (once I figure that out or reach the number of posts or whatever it takes to qualify) or can send the book to someone to look but it should not be very difficult to reproduce since it is only one line of code.
I am using code such as the following:
Code:
Range("A1:B17").RemoveDuplicates Columns:=1
where the spreadsheet contains data in columns A and B like so:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove
[/TD]
[/TR]
</tbody>[/TABLE]
The problem is that when I run the code I end up with this:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]remove[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]remove[/TD]
[/TR]
</tbody>[/TABLE]
(the real data is more complex and has blanks instead of "remove")
But when I invoke the Remove Duplicates from the Data Menu and uncheck Column B I get what I want - like this:
[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
</tbody>[/TABLE]
So not sure why the VBA behavior does not match the GUI behavior.
It does seem to be an issue only with Office for Mac - I am currently using Excel for Mac 2011 version 14.4.3 (140616) and it does not have this issue with Excel for Windows 2007 version 12.0.6683.5002 SP3 MSO 12.0.6683.5000
Also tried it on Windows Office 2010 and it works as intend.
I tried it on three different Macs - all with 14.4.3 same build without success. I don't currently have any other versions loaded up to test it on.
I develop on Mac but need to maintain compatibility with both Mac and Windows versions as I have users on both.
If I cannot get this working I may have to resort to much more complex looping type code.
I have a sample workbook that I can upload (once I figure that out or reach the number of posts or whatever it takes to qualify) or can send the book to someone to look but it should not be very difficult to reproduce since it is only one line of code.