VBA for Multiple Criteria Help

DarrenF

Board Regular
Joined
Jun 9, 2014
Messages
90
I have the below VBA for 1 Criteria (bolded below), if I would like to add a second criteria in Column M for "Slow Data", how would I write a second criteria?

Private Sub Update_Data()

lastRow = Worksheets("data").Range("A" & Rows.Count).End(xlUp).Row

For r = 2 To lastRow
If Worksheets("data").Range("AH" & r).Value = "Nokia" Then

'Worsheets("data").Rows(r).Copy
Worksheets("data").Range("AS" & r & ":AT" & r & ":AU" & r & ":AV" & r).Copy

Worksheets("Report").Activate
lastRowRpt = Worksheets("Report").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("Report").Range("A" & lastRowRpt + 1).Select

ActiveSheet.Paste

End If

Next r

End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Like this:
VBA Code:
If (Worksheets("data").Range("AH" & r).Value = "Nokia") And (Worksheets("data").Range("M" & r).Value = "Slow Data") Then
 
Upvote 0
Solution
You are welcome.
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top