Используя ячейки рабочего листа получить стандартные 56 цветов и узнать их индекс — ColorIndex — Visual Basic(Бейсик)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Private Sub CreatePaletteColours()
    With Application
         .ScreenUpdating = False
         .Workbooks.Add xlWBATWorksheet
         .ActiveWorkbook.ResetColors
         With .Range("A1:G8")
              Dim iCell As Range
              For Each iCell In .Cells
                  iColorIndex& = iColorIndex& + 1
                  iCell.Value =  iColorIndex&
                  iCell.Interior.ColorIndex = iColorIndex&
              Next
              With .Borders
                   .LineStyle = xlContinuous
                   .Weight = xlThin
                   .ColorIndex = 48
              End With
              .ColumnWidth = 3
              .RowHeight = 19.5 '.Cells(1).Width
              .VerticalAlignment = xlCenter
              .HorizontalAlignment = xlCenter
         End With
         .ScreenUpdating = True
    End With
End Sub

Leave a Comment