os dados ultrapassam os limites de caracteres para nomear abas no excel.
Como poderia resolver isso?
Sub compilação()
linha = 1 linha_fim = Range("A1").End(xlDown).Row
Range("B2:B" & linha_fim).Copy Range("U1").PasteSpecial Application.CutCopyMode = False ActiveSheet.Range("$U$1:$U$" & linha_fim).RemoveDuplicates Columns:=1, Header:= _ xlNo
linha_fim = Range("U1").End(xlDown).Row
While linha <= linha_fim Sheets.Add After:=ActiveSheet ActiveSheet.Name = Sheets("Base").Cells(linha, 2)
Sub compilação()
linha = 1
linha_fim = Range("A1").End(xlDown).Row
Range("B2:B" & linha_fim).Copy
Range("U1").PasteSpecial
Application.CutCopyMode = False
ActiveSheet.Range("$U$1:$U$" & linha_fim).RemoveDuplicates Columns:=1, Header:= _
xlNo
linha_fim = Range("U1").End(xlDown).Row
While linha <= linha_fim
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = Sheets("Base").Cells(linha, 2)
**Tamanho = Len(ActiveSheet.Name)
If Tamanho > 30 Then
ActiveSheet.Name = Mid(ActiveSheet.Name, Tamanho - 30, 30)
End If
ActiveSheet.Name = ActiveSheet**
Sheets("Base").Range("A1:S1").Copy
ActiveSheet.Range("A1").PasteSpecial
linha = linha + 1
Wend
Sheets("Base").Range("U:U").Clear
linha = 2
While Sheets("Base").Cells(linha, 1) <> "" Sheets("Base").Range("A" & linha & ":S" & linha).Copy
Wend
Sheets("Base").Range("U:U").Clear
linha = 2
While Sheets("Base").Cells(linha, 1) <> ""
Sheets("Base").Range("A" & linha & ":S" & linha).Copy
Naturezas = Sheets("Base").Cells(linha, 2)
Sheets(Naturezas).Select
Range("A10000").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
Sheets("Base").Select
linha = linha + 1
Wend
For Each aba In ThisWorkbook.Sheets
aba.Columns("A:S").AutoFit
Next
End Sub
Wend
For Each aba In ThisWorkbook.Sheets aba.Columns("A:S").AutoFit Next
End Sub