Solved

How to use VBA to copy rows with a “No” value in the last column and paste the values into another sheet?

Posted on 2016-09-08
4
34 Views
Last Modified: 2016-09-09
Key Notes:
1) All of rows with the “No” indicator will always be grouped together and at the bottom
2) One of the columns for the source data contains formulas
In the example spreadsheet I need to copy the bottom 3 rows on the ”Orders” sheet that have “No” selected in column “F” and paste the values into the “Export” sheet
Paste-Example.xlsx
0
Comment
Question by:kbay808
  • 2
4 Comments
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 250 total points
ID: 41790451
You can use this one-liner

Range(Sheet1.Range("F:F").Find("No"), Sheet1.Range("F" & Rows.Count).End(xlUp)).EntireRow.Resize(, 5).Copy Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1)
0
 

Author Comment

by:kbay808
ID: 41791363
The code works, but it’s still coping the formulas.  I need it to paste just the values.
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 41791369
then try


 Range(Sheet1.Range("F:F").Find("No"), Sheet1.Range("F" & Rows.Count).End(xlUp)).EntireRow.Resize(, 5).Copy
 Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues

Open in new window

Regards
0
 

Author Comment

by:kbay808
ID: 41791426
That worked great!!!  Thank you very much.
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

Suggested Solutions

Title # Comments Views Activity
COPY from excel to notepad 3 32
Excel copy picture into Outlook email 7 41
Excel printing page management 2 14
Excel - find text within text? 1 18
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
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.

943 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

5 Experts available now in Live!

Get 1:1 Help Now