Last active
September 6, 2020 15:48
-
-
Save mrioqueiroz/61d15111581d627a4219331506f7005d to your computer and use it in GitHub Desktop.
Macro VBA para enviar CPF e CNPJ para Área de Transferência removendo os caracteres especiais
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
Sub RemoverFormatoECopiar() | |
Dim textoOriginal As String | |
Dim novoTexto As String | |
Dim contador As Integer | |
Dim areaDeTransferencia As New MSForms.DataObject | |
textoOriginal = ActiveCell.Value | |
For contador = 1 To Len(textoOriginal) | |
Dim caractere As String | |
caractere = Mid(textoOriginal, contador, 1) | |
If IsNumeric(caractere) Then | |
novoTexto = novoTexto & caractere | |
End If | |
Next | |
areaDeTransferencia.SetText novoTexto | |
areaDeTransferencia.PutInClipboard | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment