Delete Duplicate VBA macro












0















I am using a very simple simple delete duplicate macro but its prompting me to select a column. It'll always be exactly the same column and it even highlights it but still asks me to confirm. I would like for it just to remove the duplicates.



Sub remove()
Columns("D:D").Select
ActiveSheet.Range("$A$1:$K$676").RemoveDuplicates Columns:=4, Header:=xlYes
End Sub


https://ibb.co/3NhSYG9










share|improve this question

























  • Maybe you should specify something like Columns:=Array(4).

    – harrymc
    Feb 20 at 20:31











  • This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

    – ndocds
    Feb 20 at 20:33











  • Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

    – ndocds
    Feb 20 at 20:34











  • Yes, this seems to fit better the latest documentation.

    – harrymc
    Feb 20 at 20:34






  • 1





    Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

    – Mathieu Guindon
    Feb 20 at 20:37
















0















I am using a very simple simple delete duplicate macro but its prompting me to select a column. It'll always be exactly the same column and it even highlights it but still asks me to confirm. I would like for it just to remove the duplicates.



Sub remove()
Columns("D:D").Select
ActiveSheet.Range("$A$1:$K$676").RemoveDuplicates Columns:=4, Header:=xlYes
End Sub


https://ibb.co/3NhSYG9










share|improve this question

























  • Maybe you should specify something like Columns:=Array(4).

    – harrymc
    Feb 20 at 20:31











  • This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

    – ndocds
    Feb 20 at 20:33











  • Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

    – ndocds
    Feb 20 at 20:34











  • Yes, this seems to fit better the latest documentation.

    – harrymc
    Feb 20 at 20:34






  • 1





    Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

    – Mathieu Guindon
    Feb 20 at 20:37














0












0








0








I am using a very simple simple delete duplicate macro but its prompting me to select a column. It'll always be exactly the same column and it even highlights it but still asks me to confirm. I would like for it just to remove the duplicates.



Sub remove()
Columns("D:D").Select
ActiveSheet.Range("$A$1:$K$676").RemoveDuplicates Columns:=4, Header:=xlYes
End Sub


https://ibb.co/3NhSYG9










share|improve this question
















I am using a very simple simple delete duplicate macro but its prompting me to select a column. It'll always be exactly the same column and it even highlights it but still asks me to confirm. I would like for it just to remove the duplicates.



Sub remove()
Columns("D:D").Select
ActiveSheet.Range("$A$1:$K$676").RemoveDuplicates Columns:=4, Header:=xlYes
End Sub


https://ibb.co/3NhSYG9







microsoft-excel vba macros






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 20 at 20:24









cybernetic.nomad

2,481517




2,481517










asked Feb 20 at 20:17









ndocdsndocds

226




226













  • Maybe you should specify something like Columns:=Array(4).

    – harrymc
    Feb 20 at 20:31











  • This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

    – ndocds
    Feb 20 at 20:33











  • Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

    – ndocds
    Feb 20 at 20:34











  • Yes, this seems to fit better the latest documentation.

    – harrymc
    Feb 20 at 20:34






  • 1





    Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

    – Mathieu Guindon
    Feb 20 at 20:37



















  • Maybe you should specify something like Columns:=Array(4).

    – harrymc
    Feb 20 at 20:31











  • This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

    – ndocds
    Feb 20 at 20:33











  • Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

    – ndocds
    Feb 20 at 20:34











  • Yes, this seems to fit better the latest documentation.

    – harrymc
    Feb 20 at 20:34






  • 1





    Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

    – Mathieu Guindon
    Feb 20 at 20:37

















Maybe you should specify something like Columns:=Array(4).

– harrymc
Feb 20 at 20:31





Maybe you should specify something like Columns:=Array(4).

– harrymc
Feb 20 at 20:31













This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

– ndocds
Feb 20 at 20:33





This only happens in office 365 I just tried it in 2013 and it didn't do it :-/

– ndocds
Feb 20 at 20:33













Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

– ndocds
Feb 20 at 20:34





Are you suggesting I replace Columns:=4 with Columns:=Array(4)?

– ndocds
Feb 20 at 20:34













Yes, this seems to fit better the latest documentation.

– harrymc
Feb 20 at 20:34





Yes, this seems to fit better the latest documentation.

– harrymc
Feb 20 at 20:34




1




1





Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

– Mathieu Guindon
Feb 20 at 20:37





Remove the Range.Select first line. Rule of thumb, you don't need to .Select anything to work with a range.

– Mathieu Guindon
Feb 20 at 20:37










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1407916%2fdelete-duplicate-vba-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1407916%2fdelete-duplicate-vba-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix