Помогите, пожалуйста, изменить цвет столбцов в объемной гистограмме при условии что значение в ячейках равно 1.
Код написал, чтоб красить данные в таблице, как окрасить столбцы гистограммы не знаю, помогите.
Sub макрос()
Dim r1 As Range, r2 As Range
Dim n1 As Range, n2 As Range
Dim q1 As Range, q2 As Range
Dim i As Integer, j As Integer
Dim c1 As Range, c2 As Range
Dim WCurr As Workbook
Dim Shr As Worksheet, Shp As Worksheet
Dim oChart As Chart
Dim oSeries As Series
Set WCurr = ActiveWorkbook
Set Shr = WCurr.Worksheets("Лист1")
Set Shp = WCurr.Worksheets("Лист1")
Set r2 = Shr.Range("D11")
Set r1 = Shp.Range("D11")
Set q2 = r2.End(xlDown)
Set q1 = r1.End(xlToRight)
Set n2 = Range(r2, q2)
Set n1 = Range(r1, q1)
Set Diagr = Range("D11:I14")
'Set oChart = ActiveWorkbook.Charts.Parent(, ActiveSheet)
'Set oSeries = oChart.SeriesCollection.NewSeries
For i = 1 To n2.Rows.Count
Set c2 = n2.Cells(i, 1)
For j = 1 To n1.Columns.Count
Set c1 = n1.Cells(i, j)
If c1.Value > 0 Then
With c1.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End If
Next
Next
End Sub
Ответить
|