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.
#32156
Prezados, boa tarde.

Por favor, preciso fazer com que o macro extraia todos os valores separados por vírgula e adicione na linha abaixo. Como eu consigo fazer isso?

Segue imagens de como está:

Imagem

E como eu queria que ficasse:

Imagem



Muito obrigado galera!!
#32172
Experimente:
Código: Selecionar todos
Sub RearranjaDados()
 Dim nfe As Long, pv As Long, v As Variant, i As Long
  nfe = 2
  Do
   If Cells(nfe, 2) = "" Then Exit Sub
   pv = Len(Cells(nfe, 2)) - Len(Replace(Cells(nfe, 2), ";", ""))
    If pv > 0 Then
     Rows(nfe + 1 & ":" & nfe + pv).Insert
     Cells(nfe + 1, 1).Resize(pv).Value = Cells(nfe, 1)
     v = Split(Cells(nfe, 2), ";")
      For i = LBound(v) To UBound(v)
       Cells(nfe + i, 2) = v(i)
      Next i
     nfe = nfe + pv
    End If
   nfe = nfe + 1
  Loop
End Sub
obs.
1. considerei que a tabela está nas colunas A:B a partir da linha 1
2. o resultado do código será diferente do seu em algumas células (me parece que o seu resultado apresenta algumas inconsistências)
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