Solved

Macro error - Cannot see mistake

Posted on 2016-08-18
3
45 Views
Last Modified: 2016-08-18
Hi Experts using Excel 2013

I have the following macro which has started to error since i changed the column:=2 from 1 to 2 (run time error 1004) on line
Sheets("Unique List").Range("B:B").RemoveDuplicates Columns:=2, Header:=xlYes....

cannot see the mistake..

Sub CopyandPasteValues()

    Application.ScreenUpdating = False

       Sheets("Unique List").Columns(2).ClearContents
        Sheets("Data").Range("DR:DR").SpecialCells(xlCellTypeConstants).Copy
         Sheets("Unique List").Range("B1").PasteSpecial Paste:=xlPasteValues

    Application.CutCopyMode = False
    
         Sheets("Unique List").Range("B:B").RemoveDuplicates Columns:=2, Header:=xlYes

Application.ScreenUpdating = True

End Sub

Open in new window

0
Comment
Question by:route217
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 41760842
0
 

Author Comment

by:route217
ID: 41760858
Hi expert...still errors..
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41760911
It should be Columns:=1 not Columns:=2.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now