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.
Por carlosazevedo2
Posts
#24287
Bom dia pessoal, estou precisando reestruturar uma base de dados. Estou enviando o arquivo anexo, e o que eu precisaria era uma macro que transformasse os dados da plan1 nos dados da plan2. Alguem poderia me ajudar?

Obrigado.
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#24299
Experimente:
Código: Selecionar todos
Sub RearranjaDados()
Dim k As Long, LR As Long, m As Long
  If Sheets("Plan2").[A2] <> "" Then
   Sheets("Plan2").Range("A2:J" & Sheets("Plan2").Cells(Rows.Count, 1).End(3).Row).Value = ""
  End If
   For k = 2 To Cells(Rows.Count, 1).End(3).Row
    m = Application.CountIf([A:A], Cells(k, 1))
    With Sheets("Plan2")
     LR = .Cells(.Rows.Count, 1).End(3).Row
     .Cells(LR + 1, 1).Resize(, 3).Value = Cells(k, 1).Resize(, 3).Value
     .Cells(LR + 1, 4) = m
     .Cells(LR + 1, 5).Resize(, m).Value = Application.Transpose(Cells(k, 4).Resize(m).Value)
     k = k + m - 1
    End With
   Next k
End Sub
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