angelfromabove
asked on
Proper way to add an "or" expression in VBA
Hello, Please see the expression below:originally it read as follows:
If Trim(Cell) = "41 Rank" ,Then
Cell.Offset(0, 57)
However, I'd like to add another variable to the expression so it performs the same actiona if the cell reads "41 Rank" or "42 Rank". I tried just adding the word "or" as it's written below, but the macro didn't work. I would appreciate any assistance you can offer.
If Trim(Cell) = "41 Rank" or "42 Rank" ,Then
Cell.Offset(0, 57)
If Trim(Cell) = "41 Rank" ,Then
Cell.Offset(0, 57)
However, I'd like to add another variable to the expression so it performs the same actiona if the cell reads "41 Rank" or "42 Rank". I tried just adding the word "or" as it's written below, but the macro didn't work. I would appreciate any assistance you can offer.
If Trim(Cell) = "41 Rank" or "42 Rank" ,Then
Cell.Offset(0, 57)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
comma is not needed - the underscores are just "line continuation" characters (preceeding space is required), makes code a little easier to read on multiple lines rather then on a single line.
Thanks
Thanks
ASKER
Got it thank you very much, it worked!
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
ASKER