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
38 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 50

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
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.

830 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