MatthewLane412
New Member
- Joined
- Aug 23, 2017
- Messages
- 24
I have a strings of text similar to the following (4010059877-TUR36036133 or TUR603916## 401007329) in column "AK".I need to Eliminate the TUR######## which can be at any point in the cell and has a different number behind it each time. Is There a way to delete only this part of the cell?
I have been working with InStr function but cant get it to work. I have the idea behind it.
Loc = instr(mycell,"TUR")
val = left(mycell.value,loc-1)
Here's my attempt which I get error code "Invalid procedure call or argument"
Sub Instr ()
Dim Loc as Long
Dim Val as Integer
Dim finRow As String
finRow=Sheets("Data").Range("A20000").End(xlUp).Row
Set myRange = Sheets("Data").Range ("AK2:AK" & finRow)
For Each myCell in myRange
Loc=InStr(myCell.Value, "TUR")
Val = Left (myCell.Value, Loc - 1)
End Sub
Thanks for looking, Matt
I have been working with InStr function but cant get it to work. I have the idea behind it.
Loc = instr(mycell,"TUR")
val = left(mycell.value,loc-1)
Here's my attempt which I get error code "Invalid procedure call or argument"
Sub Instr ()
Dim Loc as Long
Dim Val as Integer
Dim finRow As String
finRow=Sheets("Data").Range("A20000").End(xlUp).Row
Set myRange = Sheets("Data").Range ("AK2:AK" & finRow)
For Each myCell in myRange
Loc=InStr(myCell.Value, "TUR")
Val = Left (myCell.Value, Loc - 1)
End Sub
Thanks for looking, Matt