Solved

Additional Criteria to IF statement

Posted on 2014-01-13
2
225 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
[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 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39777669
Try

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

Author Closing Comment

by:jmac001
ID: 39777715
Thanks much that worked
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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.

626 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