MODELO DE GRÁFICO MÚLTIPLO (Multi Chart Template)

Este é um modelo para gerar um gráfico por cada linha de dados, promovendo assim uma análise individual de cada série de dados.
This is a template to generate a chart for each data line, to promote an individual analysis of each data series.
 

Grafico de Barras Bar Chart


Gráfico de Linhas Line Chart
Gráfico de Área Area Chart

Podemos construir uma tabela de dados de qualquer tamanho e configurar o gráfico como quisermos. Basta alterar os parâmetros assinalados a vermelho no código da macro:
We can build a data table of any size and configure the chart as we please. Just change the parameters marked in red in the macro code:
 
Dim grafico As ChartObject

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column < 2 Then Exit Sub
    If Target.Column > 14 Then Exit Sub
    If Target.Row < 6 Then Exit Sub
    If Target.Row > 18 Then Exit Sub
    Dim linha$
    linha = "$B$5:$n$5," & "$b$" & Target.Row & ":$N$" & Target.Row
    Set grafico = Folha7.ChartObjects(1)
    With grafico
        .Chart.SetSourceData Source:=Sheets("Account Bar").Range(linha), PlotBy:=xlRows
        .Chart.ChartType = xlColumnClustered
        .Chart.HasLegend = False
    End With
End Sub

Target.Column < 2 e Target.Column < 14 
refere-se ao intervalo das colunas da tabela de dados (B:N) 
refers to the column range of the data table (B: N) 
Target.Row < 6 e Target.Row < 18
refere-se ao intervalo das linhas da tabela de dados (6:18)
refers to the line range of the data table (6:18) 
$B$5:$n$5 
refere-se ao cabeçalho da tabela de dados
refers to data table header
Account Bar 
é o nome da folha de cálculo
is the name of the worksheet
xlColumnClustered
é o tipo de gráfico - os códigos para os diferentes tipos de gráfico podem ser visualizados aqui.
is the type of chart - the codes for the different types of chart can be viewed here.
O modelo pode ser descarregado neste link.
The template can be downloaded at this link.

Comentários

Mensagens populares deste blogue

EXCEL 2007 - FUNÇÕES PARA CALCULAR HORAS (Functions to Calculate Hours)

CONVERTER HORAS EM DIAS DE TRABALHO (Convert Hours to Workdays)

VBA EXCEL - OCULTAR LINHAS EM BRANCO (Hide Blank Rows)