Solved

Add extra step to current macro

Posted on 2016-08-18
6
45 Views
Last Modified: 2016-08-19
Hi Experts Using Excel 2013

I have the following macro which i would like to add an additional step too.
So based in the last cell in column B add the following formula to cell A2 =IFERROR(OFFSET(Data!DR2,MATCH(B2,Data!$DR$2:$DR$1303,0),-83),"")

into the VBA code...

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 Su

Open in new window

b
0
Comment
Question by:route217
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
ProfessorJimJam earned 500 total points
ID: 41760862
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:=Array(2), Header:=xlYes
         
        LastRow = Range("B" & Rows.Count).End(xlUp).Row
         
Range("A2:A" & LastRow).Formula = "=IFERROR(OFFSET(Data!DR2,MATCH(B2,Data!$DR$2:$DR$1303,0),-83),"""")"
Application.ScreenUpdating = True

End Sub
0
 

Author Comment

by:route217
ID: 41760864
Hi Profjimjam...

U are back...excellent...let me test and as always appreciate the feedback.
0
 

Author Comment

by:route217
ID: 41760875
hi Profjimjam

getting a compile error variable not defined....when testing macro..
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:route217
ID: 41760877
Fixed it..
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41760892
you are welcome.

thanks for the feedback
0
 

Author Comment

by:route217
ID: 41762286
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

626 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