Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
Avatar do usuário
Por ADILSON21
Posts Avatar
#66130
Tenho uma planilha de extrato bancário (anexo). Só que as vezes a segunda, terceira ou a quarta linha faz parte da informação de um certo lançamento, porém eu gostaria que isso fosse transposto na frente do lançamento. Se abrirem o arquivo anexo ja irão entender o problema... Desde já grato.
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#66133
#
Experimente. O código irá efetuar as alterações na própria tabela de dados.

Código: Selecionar todos
Sub RearranjaDados()
 Dim c As Range, LR As Long, b As Long, k As Long, x As Long, v As Long
  LR = Cells(Rows.Count, 3).End(3).Row
  b = Evaluate("MAX(FREQUENCY(IF(A5:A" & LR & "="""",ROW(A5:A" & LR & ")),IF(A5:A" & LR & "<>"""",ROW(A5:A" & LR & "))))")
  Application.ScreenUpdating = False
  Columns(4).Resize(, b).Insert
  For Each c In Range("B5:B" & LR).SpecialCells(4)
   If c.Offset(, 1).Value <> "SALDO DO DIA" Then
    k = c.Row
    If k > x + 1 Then
     c.Offset(, 1).Cut c.Offset(-1, 2)
     x = k: v = 0
    Else: v = v + 1: c.Offset(, 1).Cut c.Offset(-k - v + x, 1 + v + k - x): x = k
    End If
   End If
  Next c
End Sub

ADILSON21 agradeceu por isso
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord