Notifications
Clear all

ORGANIZAR DADOS E DELETAR CARACTERES

4 Posts
2 Usuários
0 Reactions
836 Visualizações
(@luke002)
Posts: 0
New Member
Topic starter
 

Bom dia

Alguns membros me ajudaram a criar esses 2 codigos a alguns dias atras porem fui trabalhar encima da planilha e ela se corrompeu e nao consigo abrir o codigo na planilha que estou trabalhando no momento. Ocorre um erro a todo momento e o codigo nao executa a funcao. Os 2 codigos estao abaixo e a planilha esta em anexo.

Macro 1

Option Explicit

Sub remover()
Dim cl As Object

For Each cl In Plan1.UsedRange

If cl.Column = 1 Then

If cl.Value <> "" Then
'remove aspas
cl.Value = Replace(cl.Value, """", "")
'remove 421520
cl.Value = Replace(cl.Value, 421520, "")
'remove vírgula
cl.Value = Replace(cl.Value, ",", "")
'remove mais
cl.Value = Replace(cl.Value, "+", "_")
'remove CommBank app
cl.Value = Replace(cl.Value, "CommBank app", "_")
'Direct Credit
cl.Value = Replace(cl.Value, "Direct Credit", "_")
'Transfer from
cl.Value = Replace(cl.Value, "Transfer from", "_")


End If

End If


Next cl
End Sub

macro2

Option Explicit

Sub dividir()

On Error Resume Next
Dim linha As Long
Dim str() As String
linha = 2

While Plan1.Range("A" & linha).Value <> ""
str = Split(Plan1.Range("A" & linha).Value, "_")
Plan1.Range("C" & linha).Value = str(0)
Plan1.Range("D" & linha).Value = str(1)
Plan1.Range("E" & linha).Value = str(2)
Plan1.Range("F" & linha).Value = str(3)

linha = linha + 1
Wend


End Sub
 
Postado : 18/02/2018 12:42 am
(@klarc28)
Posts: 0
New Member
 

Para colocar código aqui no fórum, deve-se apertar "Code", não "Quote".

Option Explicit

Sub remover()
Dim cl As Object

For Each cl In Sheet1.UsedRange

If cl.Column = 1 Then

If cl.Value <> "" Then
'remove aspas
cl.Value = Replace(cl.Value, """", "")
'remove 421520
cl.Value = Replace(cl.Value, 421520, "")
'remove vírgula
cl.Value = Replace(cl.Value, ",", "")
'remove mais
cl.Value = Replace(cl.Value, "+", "_")
'remove CommBank app
cl.Value = Replace(cl.Value, "CommBank app", "_")
'Direct Credit
cl.Value = Replace(cl.Value, "Direct Credit", "_")
'Transfer from
cl.Value = Replace(cl.Value, "Transfer from", "_")


End If

End If


Next cl
End Sub



Sub dividir()

On Error Resume Next
Dim linha As Long
Dim str() As String
linha = 2

While Sheet1.Range("A" & linha).Value <> ""
str = Split(Sheet1.Range("A" & linha).Value, "_")
Sheet1.Range("C" & linha).Value = str(0)
Sheet1.Range("D" & linha).Value = str(1)
Sheet1.Range("E" & linha).Value = str(2)
Sheet1.Range("F" & linha).Value = str(3)

linha = linha + 1
Wend


End Sub


 
Postado : 18/02/2018 1:30 am
(@luke002)
Posts: 0
New Member
Topic starter
 

klarc28

O erro persiste.... A planilha e a imagem do erro esta em anexo

 
Postado : 18/02/2018 1:39 am
(@klarc28)
Posts: 0
New Member
 

Escreva Sheet1 no lugar de BANKSTATEMENT.

 
Postado : 18/02/2018 1:40 am