Objeto Interior (Excel)

Representa el interior de un objeto.

Ejemplo:

Utilice la propiedad Interior del objeto Range para devolver el objeto Interior . En el siguiente ejemplo se establece en rojo el color del interior de la celda A1.

Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 3

En este ejemplo se obtiene el valor del color de una celda de la columna A mediante la propiedad ColorIndex y, a continuación, se usa ese valor para ordenar el rango por color.

Sub ColorSort()
   'Set up your variables and turn off screen updating.
   Dim iCounter As Integer
   Application.ScreenUpdating = False
   
   'For each cell in column A, go through and place the color index value of the cell in column C.
   For iCounter = 2 To 55
      Cells(iCounter, 3) = _
         Cells(iCounter, 1).Interior.ColorIndex
   Next iCounter
   
   'Sort the rows based on the data in column C
   Range("C1") = "Index"
   Columns("A:C").Sort key1:=Range("C2"), _
      order1:=xlAscending, header:=xlYes
   
   'Clear out the temporary sorting value in column C, and turn screen updating back on.
   Columns(3).ClearContents
   Application.ScreenUpdating = True
End Sub

Propiedades

Vea también

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.