Thread: Find Command
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1442_] Rick Rothstein \(MVP - VB\)[_1442_] is offline
external usenet poster
 
Posts: 1
Default Find Command

Text = "IJ180C-10 WHITE C/T W/COMPLY 54 IN X 50 YDS"
If Text Like " * IN X * YDS" Then
Measurement = Trim(Mid(T, InStrRev(T, " ", InStr(T, " IN X ") - 1)))
End If

Note: There are 2 spaces in front of the IN, not one as you showed in your
message.


Of course, IF there are ALWAYS two or more spaces if front of the
measurement, there is a much simpler assignment statement available...

Text = "IJ180C-10 WHITE C/T W/COMPLY 54 IN X 50 YDS"
If Text Like " * IN X * YDS" Then
Measurement = Mid$(T, InStrRev(T, " ") + 2)
End If


Rick