VBA Makro - extrakce stylů grafu

Tento skript pro MS Visual Basic v Excelu umožňuje vyextrahovat styly do listu "t". Nejprve se provede kontrola, zda byla vybrána oblast grafu. Pokud oblast grafu nebyla vybrána, tak se makro ukončí.

 Sub vyextrahuj_styly_grafu()
    Dim it As ChartObject, j As Integer, i As Integer, r As Integer, wsT As Worksheet
    
    Set wsT = Sheets("t")
    If TypeName(Selection) <> "ChartArea" Then
       MsgBox "Please select ChartArea, not" + TypeName(Selection)
    Exit Sub
    End If
    
    For j = 1 To ActiveChart.SeriesCollection.Count
        r = r + 1
        With ActiveChart.SeriesCollection(j)
            wsT.Cells(r, 1) = .Fill.ForeColor
            wsT.Cells(r, 2) = .MarkerStyle
            wsT.Cells(r, 3) = .MarkerSize
            wsT.Cells(r, 4) = .MarkerForegroundColor
        End With
    Next
End Sub

Komentáře

Oblíbené příspěvky