View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] oferns@gmail.com is offline
external usenet poster
 
Posts: 1
Default Like Operator vs Regular Expressions

HI,
you can use vbscripts regular expression function like this..

Sub DelIt()
Dim re As Object, cell As Range
Set re = CreateObject("VBScript.Regexp")
re.Pattern = "(-[^-]*){3}$"
For Each cell In Selection
cell.Offset(0, 1).Value = re.Replace(cell.Value, "")
Next
End Sub


M$ Documentation:
http://msdn.microsoft.com/library/de.../en-us/script5
6/html/vsobjregexp.asp
Hth,
OJ