'Mesclando Células' em uma tabela

0

Eu tenho uma planilha do excel que tem um número de entidades que são definidas pelo 'Número do trabalho'. No entanto, eu preciso de várias linhas por trabalho, o que significa que a coluna acaba tendo duplicatas, como em

Existeumamaneiradecombinarcadagrupodenúmerodetrabalhoidênticoparaqueelessejamumalinha'única'?éoqueéolayoutpreferido.

Nota: cada trabalho tem a garantia de ser de 3 linhas, por isso seguirá sempre o mesmo padrão. Existe uma maneira de fazer isso?

    
por Maxim Srour 23.07.2018 / 03:19

2 respostas

2

Experimente este código:

Sub Test() TitleRow = 1 'if title contain more than one row, change the value 1 to the actual number of rows i = 0 Application.DisplayAlerts = False Do Set StartCell = ActiveSheet.Range("A" & (TitleRow + 3 * i + 1)) Set EndCell = ActiveSheet.Range("A" & (TitleRow + 3 * i + 3)) With ActiveSheet.Range(StartCell, EndCell) .Merge .VerticalAlignment = xlCenter .HorizontalAlignment = xlCenter End With i = i + 1 Loop Until Range("A" & (TitleRow + 3 * i) + 1) = "" Application.DisplayAlerts = True End Sub

    
por 23.07.2018 / 12:00
-1

Pode ser feito facilmente usando macro ou VBA, Edite o código abaixo no VBA conforme sua necessidade.

Range ("A1: A3"). Selecione     Com seleção         .HorizontalAlignment = xlCenter         .VerticalAlignment = xlBottom         .WrapText = False         ORIENTAÇÃO = 0         .AddIndent = False         .IndentLevel = 0         .ShrinkToFit = False         .ReadingOrder = xlContext         .MergeCells = False     Fim com     Selection.Merge     Com seleção         .HorizontalAlignment = xlCenter

    
por 23.07.2018 / 07:27