Reputation: 934
Currently I'm copying some data onto another worksheet but need to input multiple conditions in my if
function - within my workbook, column H
has chocolate, strawberry, vanilla - I just want chocolate and strawberry to be shifted to the next sheet. So far I have,
If Sheets("Sheet1").Cells(i, "H").Value = "chocolate"
How do I tell VBA to move the whole row if column H
has chocolate or strawberry? I tried -
If Sheets("Sheet1").Cells(i, "H").Value = "chocolate" Then
ElseIf If Sheets("Sheet1").Cells(i, "H").Value = "strawberry"
But it ended up just keeping only the strawberry rows.
Upvotes: 0
Views: 88
Reputation: 473
Use this for your vba If statement.
If Sheets("Sheet1").Cells(i, "H").Value = "chocolate" Or Sheets("Sheet1").Cells(i, "H").Value = "Strawberry" Then
...
Your code
End If
Upvotes: 1