Solved

Add extra step to current macro

Posted on 2016-08-18
6
28 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
  • 4
  • 2
6 Comments
 
LVL 25

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

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

Expert Comment

by:ProfessorJimJam
ID: 41760892
you are welcome.

thanks for the feedback
0
 

Author Comment

by:route217
ID: 41762286
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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.

744 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

13 Experts available now in Live!

Get 1:1 Help Now