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

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