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
31 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
Comment Utility
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
Comment Utility
The code works, but it’s still coping the formulas.  I need it to paste just the values.
0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 250 total points
Comment Utility
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
Comment Utility
That worked great!!!  Thank you very much.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This is an Add-On procedure to be used in conjunction with the code provided in Reducing EE Email Clutter using Outlook (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3146-Outlook-Processing-EE-emails-on-Receive.…
Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

762 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

6 Experts available now in Live!

Get 1:1 Help Now