Oaktree
MrExcel MVP
- Joined
- Jun 20, 2002
- Messages
- 8,120
- Office Version
- 365
In a VBE If-Then statement, how can I get Excel to do multiple "Thens"? In the code below, what I'm TRYING to do is, when three rows in a cell match certain criteria, copy elements of that row to a different sheet. But, I can't get the line after the "Then" to abide by the IF statement (i.e. the second line is ALWAYS copied, regardless of whether the row matches the criteria of the IF statement). Can I use "AND" or something to accomplish this?
Thanks,
Oaktree
If Sheets("Log").Range("FirstYear").Offset(Row - 3, 1).Value = Range("DOTWeek").Value _
And Sheets("Log").Range("A3").Offset(Row - 3, 0) = Range("DOTYear").Value _
And Sheets("Log").Range("A3").Offset(Row - 3, 2) = Range("DOTIsDOT").Value _
Then Sheets("Reports").Range("A8").Offset(Row - 3, 0).Value = Sheets("Log").Range("FirstYear").Offset(Row - 3, 1)
Sheets("Reports").Range("A8").Offset(Row - 3, 1).Value = Sheets("Log").Range("FirstYear").Offset(Row - 3,
This message was edited by Oaktree on 2002-06-21 10:29
Thanks,
Oaktree
If Sheets("Log").Range("FirstYear").Offset(Row - 3, 1).Value = Range("DOTWeek").Value _
And Sheets("Log").Range("A3").Offset(Row - 3, 0) = Range("DOTYear").Value _
And Sheets("Log").Range("A3").Offset(Row - 3, 2) = Range("DOTIsDOT").Value _
Then Sheets("Reports").Range("A8").Offset(Row - 3, 0).Value = Sheets("Log").Range("FirstYear").Offset(Row - 3, 1)
Sheets("Reports").Range("A8").Offset(Row - 3, 1).Value = Sheets("Log").Range("FirstYear").Offset(Row - 3,
This message was edited by Oaktree on 2002-06-21 10:29