erik.van.geit
MrExcel MVP
- Joined
- Feb 1, 2003
- Messages
- 17,832
Hi, gurus!
What's the starting position of txt2 found in txt1 ?
I can make code that loops through the text
Sub find_txt_position()
txt1 = "abcdEFGhijkEFGlm"
txt2 = "eFG"
For ch = 1 To Len(txt1) - Len(txt2)
If UCase(txt2) = UCase(Mid(txt1, ch, Len(txt2))) Then
Exit For
End If
Next ch
MsgBox "the text """ & txt2 & """ is found in """ & txt1 & """ starting from character # " & ch
End Sub
but what's the "right VBA-tool" to do this ?
it is like the worksheetequivalent in the example below
kind regards,
Erik
What's the starting position of txt2 found in txt1 ?
I can make code that loops through the text
Sub find_txt_position()
txt1 = "abcdEFGhijkEFGlm"
txt2 = "eFG"
For ch = 1 To Len(txt1) - Len(txt2)
If UCase(txt2) = UCase(Mid(txt1, ch, Len(txt2))) Then
Exit For
End If
Next ch
MsgBox "the text """ & txt2 & """ is found in """ & txt1 & """ starting from character # " & ch
End Sub
but what's the "right VBA-tool" to do this ?
it is like the worksheetequivalent in the example below
kind regards,
Erik
leads 050121 1328.XLS | ||||||
---|---|---|---|---|---|---|
D | E | F | G | |||
1 | 5 | EFG | abcdEFGhijkEFGlm | |||
Blad1 |