Ejemplo del procedimiento de Visual Basic
Sub ColorIndexList()
' Begin error trapping.
On Error GoTo Done
Range("A1").Select
' Put the word Color in active cell.
ActiveCell.Formula = "Color"
' Put the words Color Index Number one cell to right of active cell.
ActiveCell.Offset(0, 1).Formula = "Color Index Number"
' Select one cell down from active cell.
ActiveCell.Offset(1, 0).Activate
' Begin loop from 1 to 56.
For xColor = 1 To 56
' Apply color and pattern properties to active cell.
With ActiveCell.Interior
.ColorIndex = xColor
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
' Put color index in cell to right of active cell.
ActiveCell.Offset(0, 1).Formula = xColor
' Select next cell down.
ActiveCell.Offset(1, 0).Activate
' Increment For loop.
Next xColor
Done:
End Sub
Nota Esta macro imprime una muestra de 56 colores, aunque las versiones posteriores de Excel admiten muchos más colores.
No hay comentarios:
Publicar un comentario