reubanrao93
New Member
- Joined
- Dec 7, 2020
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
Hey gurus,
I'm creating a macro sheet to run the following formula into column Q, however I keep running into Type mismatch 13 error over the InStr function. The raw data for Range N does not contain ",OPON" hence why the error occurs. Is there a way for me to modify this code to run even if the range don't have ",OPON" without stopping abruptly? Thank you
Sheets("OUTPUT").Range("Q:Q").Select
If InStr(1, (Range("N1").Value), ",OPON") > 0 Then
ActiveCell.Formula = "=LEFT(N1,FIND("",OPO"",N1)-1)"
Else: ActiveCell.Formula = "=LEFT(N1,4)"
I'm creating a macro sheet to run the following formula into column Q, however I keep running into Type mismatch 13 error over the InStr function. The raw data for Range N does not contain ",OPON" hence why the error occurs. Is there a way for me to modify this code to run even if the range don't have ",OPON" without stopping abruptly? Thank you
Sheets("OUTPUT").Range("Q:Q").Select
If InStr(1, (Range("N1").Value), ",OPON") > 0 Then
ActiveCell.Formula = "=LEFT(N1,FIND("",OPO"",N1)-1)"
Else: ActiveCell.Formula = "=LEFT(N1,4)"