Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Oscar Montgomery   on Oct 20 In MS Office Category.

  
Question Answered By: Jim Williamson   on Oct 20

I'd like to add on to what Sujay has contributed, which is to introduce the
VBA InStr() function to those who might not be familiar with it. It could be
used in Sujay's code like this:



Sub om()

Dim a As String

a = Range("a1")

pos = InStr(s, "FOX", vbCompareText)

If pos > 0 Then

MsgBox ("Fox does exist at " & pos & " character to " & pos + 3) Else

MsgBox ("Fox does not exist")

End If

End Sub



InStrRev() finds strings starting at the end of the string instead of the
beginning, which is sometimes useful also.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Find Word from long statement Or get search suggestion and latest updates.


Tagged: