bfournier5
New Member
- Joined
- Apr 17, 2018
- Messages
- 17
Hello, looking for some help to get this code working. The code I have working so far is to check if some specific text is part of a range or not. The saerch tells me if the text is French or English by searching for specific words. This part works and will place the value where the text is in a cell. Here is the code I have
' To see if the greeting is in English …
ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)"
ActiveCell.Offset(1, 0).Select
' To see if the greeting is in French …
ActiveCell.Formula = "=MATCH(P2,SingleInteraction,0)"
ActiveCell.Offset(-1, 0).Select
IsEnglish = ActiveCell.Value
GreetingRow = ActiveCell.Value
Range("S4").Select
ActiveCell.Offset(GreetingRow - 1, 0).Select
Selection.Copy
If the IsEnglish variable has a number - the code works. It means the result of ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)" is a value and then I get what I want.
If the result of ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)" is #n/a, then the code stop, which is normal because I want the code to go to take the value from ActiveCell.Formula = "=MATCH(P2,SingleInteraction,0)". Note that I'm in a If ... then ... Else with a loop.
' To see if the greeting is in English …
ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)"
ActiveCell.Offset(1, 0).Select
' To see if the greeting is in French …
ActiveCell.Formula = "=MATCH(P2,SingleInteraction,0)"
ActiveCell.Offset(-1, 0).Select
IsEnglish = ActiveCell.Value
GreetingRow = ActiveCell.Value
Range("S4").Select
ActiveCell.Offset(GreetingRow - 1, 0).Select
Selection.Copy
If the IsEnglish variable has a number - the code works. It means the result of ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)" is a value and then I get what I want.
If the result of ActiveCell.Formula = "=MATCH(P1,SingleInteraction,0)" is #n/a, then the code stop, which is normal because I want the code to go to take the value from ActiveCell.Formula = "=MATCH(P2,SingleInteraction,0)". Note that I'm in a If ... then ... Else with a loop.