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
42 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
[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
  • 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 52

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

617 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