willi1jd@westinghouse.com
Guest
Re: Macro Help for Substrings
Sub ExtactText()
Dim nStart As Integer, nEnd As Integer
Dim txtString As String, txtSearch As String
'Next two lines create a test sample
cells(1, 1) = "delete all of this FROM column a WHERE delete all of
this."
txtString = ActiveCell
txtSearch = "FROM"
nStart = InStr(1, txtString, txtSearch) + Len(txtSearch) + 1
txtSearch = "FROM"
nEnd = InStr(1, txtString, txtSearch)
txtString = Mid(txtString, nStart, Len(txtString) - nStart - nEnd)
''Next line pastes results of test sample
ActiveCell.Offset(0, 1) = txtString
End Sub
Bookmarks