resaltar numeros en ambos cuadros

dragonfire33

Board Regular
Joined
Oct 7, 2021
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Tengo el siguiente código y lo que hace es resaltar el último número agregado dividido entre las columnas ABCD en las casillas, pero solo resalta el rango "g3:m12" y me gustaría que ese mismo número se resaltara con color rojo en el rango "g16:m25" del libro de excel , pero para eso debo modificar gran parte del codigo como lo hago?
VBA Code:
Sub Worksheet_Change privado (rango de destino byval)
Dim uF&, i&, nBusca%, Celda As Range
Si no intersect(target, columns(4)) no es nada entonces
Rango ("G3:G12,I3:I12,K3:K12,M3:M12"). Interior.Color = vbBlanco
Para i = 0 a 3
            nBusca = Target.Offset(0, i - 3)
Seleccionar Caso i
Caso 0
Set Celda = Rango("G3:G12"). Buscar(nBusca, , , xlWhole)
Caso 1
Set Celda = Rango("I3:I12"). Buscar(nBusca, , , xlWhole)
Caso 2
Set Celda = Rango("K3:K12"). Buscar(nBusca, , , xlWhole)
Caso 3
Establezca Celda = Rango("M3:M12"). Buscar(nBusca, , , xlWhole)
            
               
Finalizar selección
Si no celda no es nada entonces
                Celda.Interior.Color = vbRed
Fin si
Siguiente i
Rango ("G2"). Activar
Fin si
Fin sub
[/CÓDIGO]
 

Attachments

  • 22.png
    22.png
    128.9 KB · Views: 21
ejecute el codigo dos veces y bien pero al ejecutarla por tercera vez me arrojo ese error
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Es un problema en tu macro. Es un tema diferente al título de este hilo.
Podrías crear un nuevo hilo, ahí describes cuál es el objetivo de tu macro, en qué línea aparece el error y qué dice el mensaje de error.
El error es que en la hoja donde van los datos el margen de los bordes estaba incompleto por eso al pegar dichos datos arrojaba dicho error
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top