Saltar al contenido principal

¿Cómo cambiar el color de la celda cuando se hace clic o se selecciona la celda en Excel?

Este artículo le mostrará algunos métodos sobre cómo cambiar el color de la celda mientras hace clic en una celda y cambiar el color resaltado mientras selecciona un rango de celdas en Excel.

Cambiar el color de la celda cuando se hace clic en la celda con el código VBA
Cambie el color resaltado cuando las celdas se seleccionan con el código VBA
Resalte toda la fila y columna de la celda activa con Kutools para Excel


Cambiar el color de la celda cuando se hace clic en la celda con el código VBA

Aquí, puede cambiar el color de fondo de una celda al hacer doble clic en ella o hacer clic derecho sobre ella con el siguiente código VBA.

1. En la hoja de trabajo, cambiará el color de la celda al hacer clic en ella, haga clic con el botón derecho en la pestaña de la hoja y haga clic en Ver código desde el menú contextual.

2. En el Microsoft Visual Basic para aplicaciones ventana, copie y pegue el siguiente código VBA en el Código ventana.

VBA: cambia el color de la celda al hacer clic en ella

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Target.Interior.Color = vbRed
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Target.Interior.Color = vbGreen
End Sub

3. Prensa otro + Q teclas simultáneamente para cerrar el Microsoft Visual Basic para aplicaciones ventana.

Luego, cuando haga doble clic en una celda, se coloreará en rojo. Y cuando haga clic con el botón derecho en una celda, se coloreará en verde. Ver captura de pantalla:


Un clic para resaltar la fila y columna de la celda seleccionada en Excel:

Kutools for Excel's Diseño de lectura La utilidad le ayuda a resaltar rápidamente la fila y la columna de la celda seleccionada en Excel, como se muestra en la siguiente demostración.
¡Descárgalo y pruébalo ahora! (Pista gratuita de 30 días)


Cambie el color resaltado cuando las celdas se seleccionan con el código VBA

De forma predeterminada, al seleccionar un rango de celdas, el color resaltado es gris. Si desea resaltar más el rango seleccionado, puede cambiar su color resaltado al que necesite. Haz lo siguiente.

1. Haga clic con el botón derecho en la pestaña de la hoja en la que desea cambiar el color resaltado del rango seleccionado y haga clic en Ver código desde el menú contextual.

2. En el Microsoft Visual Basic para aplicaciones ventana, copie y pegue el siguiente código VBA en el Código ventana.

Código VBA: cambia el color resaltado del rango seleccionado

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Target
        .Worksheet.Cells.FormatConditions.Delete
        .FormatConditions.Add xlExpression, , "TRUE"
        .FormatConditions(1).Interior.Color = vbYellow
    End With
End Sub

3. Prensa otro + Q teclas al mismo tiempo para cerrar el Microsoft Visual Basic para aplicaciones ventana.

A partir de ahora, el color resaltado del rango o celda seleccionada se cambia a amarillo. Cuando hace clic en otra celda o rango de celdas, las celdas se colorearán automáticamente.


Resalte toda la fila y columna de la celda activa con Kutools para Excel

Si se trata de una hoja de trabajo grande, es necesario resaltar toda la fila y columna de la celda activa para facilitar la lectura. Aquí el Diseño de lectura utilidad de Kutools for Excel puedo ayudarte.

Antes de aplicar Kutools for Excel, Por favor descargarlo e instalarlo en primer lugar.

1. Hacer clic en Kutools > Diseño de lectura. Ver captura de pantalla:

Luego, el diseño de lectura está habilitado, puede ver que la fila y la columna de la celda activa se resaltan inmediatamente.

Note: Puede cambiar la configuración del diseño de lectura según sus necesidades, como se muestra a continuación.

  Si desea tener una prueba gratuita (30 días) de esta utilidad, haga clic para descargarloy luego vaya a aplicar la operación según los pasos anteriores.


Resalte toda la fila y columna de la celda activa con Kutools para Excel

Las mejores herramientas de productividad de oficina

🤖 Asistente de IA de Kutools: Revolucionar el análisis de datos basado en: Ejecución inteligente   |  Generar codigo  |  Crear fórmulas personalizadas  |  Analizar datos y generar gráficos  |  Invocar funciones de Kutools...
Características populares: Buscar, resaltar o identificar duplicados   |  Eliminar filas en blanco   |  Combine columnas o celdas sin perder datos   |   Ronda sin fórmula ...
Super búsqueda: Búsqueda virtual de criterios múltiples    Búsqueda V de valores múltiples  |   VLookup en varias hojas   |   Búsqueda difusa ....
Lista desplegable avanzada: Crear rápidamente una lista desplegable   |  Lista desplegable dependiente   |  Lista desplegable de selección múltiple ....
Administrador de columnas: Agregar un número específico de columnas  |  Mover columnas  |  Toggle Estado de visibilidad de columnas ocultas  |  Comparar rangos y columnas ...
Características destacadas: Enfoque de cuadrícula   |  Vista de diseño   |   Gran barra de fórmulas    Administrador de hojas y libros de trabajo   |  Biblioteca de Recursos (Texto automático)   |  Selector de fechas   |  Combinar hojas de trabajo   |  Cifrar/descifrar celdas    Enviar correos electrónicos por lista   |  Súper filtro   |   Filtro especial (filtro negrita/cursiva/tachado...) ...
Los 15 mejores conjuntos de herramientas12 Texto Herramientas (Añadir texto, Quitar caracteres, ...)   |   50+ Tabla Tipos (Diagrama de Gantt, ...)   |   40+ Práctico Fórmulas (Calcular la edad según el cumpleaños, ...)   |   19 Inserción Herramientas (Insertar código QR, Insertar imagen desde la ruta, ...)   |   12 Conversión Herramientas (Números a palabras, Conversión de Moneda, ...)   |   7 Fusionar y dividir Herramientas (Filas combinadas avanzadas, Células partidas, ...)   |   ... y más

Mejore sus habilidades de Excel con Kutools for Excel y experimente la eficiencia como nunca antes. Kutools for Excel ofrece más de 300 funciones avanzadas para aumentar la productividad y ahorrar tiempo.  Haga clic aquí para obtener la función que más necesita...

Descripción


Office Tab lleva la interfaz con pestañas a Office y hace que su trabajo sea mucho más fácil

  • Habilite la edición y lectura con pestañas en Word, Excel, PowerPoint, Publisher, Access, Visio y Project.
  • Abra y cree varios documentos en nuevas pestañas de la misma ventana, en lugar de en nuevas ventanas.
  • ¡Aumenta su productividad en un 50% y reduce cientos de clics del mouse todos los días!
Comments (28)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, i built a dashboard with 37 worksheets, everyone with a table. All of them are lock panels because are to large and i need to know the number and name of the student who am i entering data for. Despite that, i have to keep my finger on the left side of the screen to identify the names and numbers to which the entered data refer.  So, i need to identify the first two cells of the row, in the columns "I" and "J".
The code that i took from the internet and couldn't change for the two cells of columns "I" and "J" was:

Dim lTarget As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row >= 16 Then

If Not lTarget Is Nothing Then

lTarget.EntireRow.Interior.ColorIndex = 0
End If

Target.EntireRow.Interior.Color = 9359529

Set lTarget = Target
End If
End Sub

All tables begin in diferent rows. This example start in 16 row but i put the code in all the pages and adapt to the needs of the specific row number. 
I've already tried to change the code from EntireRow to Range ("I16:J43") but the cells were in the range became all painted with the code color.
Already try a diferent way through the "conditional formatting" with the formula =E($I16<>"";LIN()=CÉL("lin")) in the range $I16:$J43, and in the developer "worksheet", with "Application.Calculate" and it works. I change in the 37 worksheets but i was copying and data from the previous file to this new one and I noticed that the options to paste "values", etc, disappear from my dashboard. The code must be executing something that, like clicking on the cell, no longer lets it paste. A single option was to paste with CTRL+V.
If someone can help me with the code, i'll delete the VBA "Application.Calculate" to to get back to the available collage options.
Thak you for your help.

Luís Lopes
This comment was minimized by the moderator on the site
Hello, the code used to work for a while, but now it doesn't anymore. What can there be wrong?
This comment was minimized by the moderator on the site
Hi Rens Borburgh,There are two codes provided in the post, which one did you use? Did you get any error prompt?
This comment was minimized by the moderator on the site
I have tried them both at the same time. After copying it to a usb stick it didn't work anymore.
This comment was minimized by the moderator on the site
Hi Rens Borburgh,I don't quite understand what you mean. The codes should be used in the sheet code window and not in the Module window. Or can you provide a screenshot of your code window?
This comment was minimized by the moderator on the site
Hi, I am trying to use the double click option to change a cell to green but i also want that cell to go back to no fill or white if i double click it whilst it is green. Is this possible? 
This comment was minimized by the moderator on the site
alguien que me ayude solo quiero que al hacerle click a una celda se ponga de un color y que se mantenga ese color y si le vuelvo hacer click regrese el color original que tenia
This comment was minimized by the moderator on the site
How to highlight the cell(with data) to automatically highlight the other cells (data which is related another data in a previous cell) with click of the cell.Can i do it. Is there a way to do it.
This comment was minimized by the moderator on the site
The code works as long as I do not protect the worksheet. Once I protect the worksheet, because I have conditional formatting on locked cells, the code will not work. How can I change this so that it works on locked worksheet where the user can select unlocked cells?
This comment was minimized by the moderator on the site
Hi,
is it possible to have a code for "change cell color when clicking on it" in the way that it will not change already formated cells with another color, please?
After applying your code all my formating (colours) is away. Thank you. Veronika
This comment was minimized by the moderator on the site
Thank you. Great Job
This comment was minimized by the moderator on the site
hi
the is working grate but i want that the color should only be when the cell is selected and when i select something else, the first cell i selcted should not be colored
can you help me pls with this thanks
This comment was minimized by the moderator on the site
I had that exact same question! I hope someone will answer you! The reason I am looking for this is I have a spreadsheet I use daily and put in lots of information into single cells. It gets hard to see the values (visually, it runs into info in other cells), and would be a great feature if I could change the color of the cell being edited - only while it is being edited. The simplest solution I can think of is that the cell value would be set back to what it was prior to being clicked on - but I don't know how to do that.
This comment was minimized by the moderator on the site
Hi, I am trying to figure out how to change the color of a cell, based on a selection from a dropdown list. For example, HIGH=red, MEDIUM=yellow, LOW=green.

Any tips you can provide are greatly appreciated. Thank You
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations