cfdh_edmundo
Board Regular
- Joined
- Nov 9, 2005
- Messages
- 133
I have the following lines of code
This works fine, but I want to adjust the Withs so that the first With command also runs if the Sheet is called "(Pasted) Sidney Back Testing"
And the second With will also run if the sheet is called "(Pasted) Ursula Back Testing"
I've tried to use an OR operator with two With commands, but the text becomes red suggesting there is an error in my code
Does anyone know of a neat way of using an OR within a With
Many thanks for any help!
Code:
With Sheets("(Pasted) Sidney BT")
Dim lastrow As Long
lastrow = .Range("B" & .Rows.Count).End(xlUp).Row
.Range("A1:AA" & lastrow).Copy wks.Range("A" & wks.Rows.Count).End(xlUp)
End With
With Sheets("(Pasted) Ursula BT")
lastrow = .Range("B" & .Rows.Count).End(xlUp).Row
.Range("A7:AA" & lastrow).Copy wks.Range("A" & wks.Rows.Count).End(xlUp).Offset(1)
End With
This works fine, but I want to adjust the Withs so that the first With command also runs if the Sheet is called "(Pasted) Sidney Back Testing"
And the second With will also run if the sheet is called "(Pasted) Ursula Back Testing"
I've tried to use an OR operator with two With commands, but the text becomes red suggesting there is an error in my code
Code:
With Sheets("(Pasted) Ursula BT") or With Sheets("(Pasted) Ursula Back Testing")
Does anyone know of a neat way of using an OR within a With
Many thanks for any help!