Realizar filtro de acuerdo a valor de la celda

dragonfire33

Board Regular
Joined
Oct 7, 2021
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Se puede realizar un filtro como se muestra en la imagen de la parte derecha de la hoja
 

Attachments

  • Screenshot_20240809-111942.png
    Screenshot_20240809-111942.png
    190.5 KB · Views: 19

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Puedo observar que los datos empiezan en 0 y van del 0 al 9, luego 1 y van del 0 al 9 y así hasta el 9.

Si tus datos están como en tu imagen, prueba lo siguiente:

VBA Code:
Sub filtrar()
  Dim nRow%, n1%, n2%, n3%, n4%, r
  Application.ScreenUpdating = False
  
  n1 = Range("BB1").Value
  n2 = Range("BC1").Value
  n3 = Range("BD1").Value
  n4 = Range("BE1").Value
    
  nRow = (n1 * 2 * 10 + 2) + (n2 * 2)
  Range("A" & nRow).Resize(2, 8).Copy Range("BB5")
  
  nRow = (n2 * 2 * 10 + 2) + (n3 * 2)
  Range("I" & nRow).Resize(2, 8).Copy Range("BB7")
  
  nRow = (n3 * 2 * 10 + 2) + (n4 * 2)
  Range("Q" & nRow).Resize(2, 8).Copy Range("BB9")
  
  nRow = (n1 * 2 * 10 + 2) + (n4 * 2)
  Range("Y" & nRow).Resize(2, 8).Copy Range("BB11")
  
  nRow = (n1 * 2 * 10 + 2) + (n3 * 2)
  Range("AG" & nRow).Resize(2, 8).Copy Range("BB13")
  
  nRow = (n2 * 2 * 10 + 2) + (n4 * 2)
  Range("AO" & nRow).Resize(2, 8).Copy Range("BB15")
  
  For Each r In Array("BB5", "BB7", "BB9", "BB11", "BB13", "BB15")
    Range(r).Resize(2, 8).Borders(xlEdgeLeft).LineStyle = xlContinuous
    Range(r).Resize(2, 8).Borders(xlEdgeTop).LineStyle = xlContinuous
    Range(r).Resize(2, 8).Borders(xlEdgeBottom).LineStyle = xlContinuous
    Range(r).Resize(2, 8).Borders(xlEdgeRight).LineStyle = xlContinuous
  Next
  
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Hola Dante buenos días la hoja empieza desde la columna A
 

Attachments

  • Screenshot_20240809-110337.png
    Screenshot_20240809-110337.png
    178 KB · Views: 7
Upvote 0
Por favor me puede colaborar con la pregunta modificar código para resaltar tres celdas en línea horizontal o vertical gracias
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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