View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] willi1jd@westinghouse.com is offline
external usenet poster
 
Posts: 3
Default Macro Help for Substrings

Sorry, Sent the wrong one.

Sub ExtactText()
Dim nStart As Integer, nEnd As Integer
Dim txtString As String

txtString = ActiveCell

nStart = InStr(1, txtString, "FROM") + 5
nEnd = InStr(1, txtString, "WHERE")
txtString = Mid(txtString, nStart, nEnd - nStart - 1)

ActiveCell.Offset(0, 1) = txtString
End Sub