Last active
August 29, 2015 14:11
-
-
Save chepe263/40427b0ecc5d22875346 to your computer and use it in GitHub Desktop.
VBA-Excel: Buscar si palabra tiene tilde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'http://stackoverflow.com/questions/22542834/how-to-use-regular-expressions-regex-in-microsoft-excel-both-in-cell-and-loops | |
Sub buscarAcentos() | |
Dim regEx As New RegExp | |
Dim strPattern As String: strPattern = "[áéíóúÁÉÍÓÚ]" | |
Dim Myrange As Range | |
Dim i As Integer | |
With regEx | |
.Global = True | |
.MultiLine = True | |
.IgnoreCase = False | |
.Pattern = strPattern | |
End With | |
For i = 5 To 124 | |
Set Myrange = ActiveSheet.Range("B" & i) | |
strInput = Myrange.Value | |
If regEx.Test(strInput) Then | |
Range("F" & i).Value = strInput | |
Range("G" & i).Value = "" | |
Else | |
Range("G" & i).Value = strInput | |
Range("F" & i).Value = "" | |
End If | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment