View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Dave is offline
external usenet poster
 
Posts: 1,388
Default Regular expressions

Hello,

The snippet of code below builds a new string "Newval" based on the pattern
[A-Z]
and that works fine but what if I wanted to exclude values .
For example I could set a pattern of "[)(*&^]" how would I code it to
exclude those values?

With RegExp
.Global = True
.Pattern = "[A-Z]"
End With
Set Myrange = ActiveSheet.Range("A1:A10")
For Each C In Myrange
newval = ""
Set Collection = RegExp.Execute(C.Value)
For Each RegMatch In Collection
newval = newval & RegMatch
Next
Next


D