VBA excel FIND formula isse

I'm trying to use the formula FIND in order to search for the position of the first character @ from the text on my cell A1 as: FIND("@";A1) using the following the code:

LR = Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To LR
    cel = "A" & i
    Range("Q" & i).Formula = "=FIND(" & "@" & "," & cel & ")"

Next i

Any help to solve the problem of my code is highly appreciated

Thanks in advance

Upvotes: 0

Views: 53

Answers (1)

DisplayName
DisplayName

Reputation: 13386

You could use Instr() function to directly write searched character position:

For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
    Range("Q" & i).Value = Instr(Range("A" & i).Value2, "@")
Next 

Upvotes: 1

Related Questions