Solved

Additional Criteria to IF statement

Posted on 2014-01-13
2
186 Views
Last Modified: 2014-01-13
I have VBA that opens a file and copies data over based on name in column A.  How would I update the statement to look at criteria in column A (Vxxxxxxx) and Column C (Axxxxxx)? I try to update but couldn't get the right combination.


Here is the part of the code with the if statement

   For I = 2 To lastSourceCell.Row
            If ws.Range("A" & I).Value = "Vxxxxxxx" Then
                ws.Range("A" & I).EntireRow.Copy
                ThisWorkbook.Sheets("ISS").Range("A" & destinationRow).PasteSpecial xlPasteAll
                destinationRow = destinationRow + 1
            End If
        Next

Open in new window


If all of the VBA is needed, please let me know.
0
Comment
Question by:jmac001
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
Comment Utility
Try

If ws.Range("A" & I).Value = "Vxxxxxxx" and ws.Range("C" & I).Value = "Axxxxxxx" Then
0
 

Author Closing Comment

by:jmac001
Comment Utility
Thanks much that worked
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
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…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

771 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

15 Experts available now in Live!

Get 1:1 Help Now