Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BuscarV con rango dinámico

publicado

Buenas,

Nunca he sabido muy bien cómo programar el buscarv para que busque en un rango dinámico y no en uno fijo, normalmente si más o menos sé que donde tiene que buscar nunca va a pasar de las 2000 filas pues pongo que busque de 1 a 2000, pero me gustaría saber cómo hacerlo para que fuese dinámico y buscase en la totalidad de filas que tenga la hoja en ese momento.

Muchas gracias.

Os paso el ejemplo de cómo lo hago hasta ahora.

 

Ej_BuscarV.xlsm

Featured Replies

publicado
Sub Buscaenhoja2(): On Error Resume Next
Application.ScreenUpdating = False
Sheets("Hoja1").Activate
For x = 2 To Range("A" & Rows.Count).End(xlUp).Row
   Cells(x, "B").Value = _
      WorksheetFunction.VLookup((Cells(x, "A").Value), _
         Sheets("Hoja2").Range("A1").CurrentRegion, 2, 0)
Next
Application.ScreenUpdating = True
End Sub

 

Editado el por Antoni

publicado
hace 2 minutos , Antoni dijo:
Sub Buscaenhoja2(): On Error Resume Next
Application.ScreenUpdating = False
Sheets("Hoja1").Activate
For x = 2 To Range("A" & Rows.Count).End(xlUp).Row
   Cells(x, "B").Value = _
      WorksheetFunction.VLookup((Cells(x, "A").Value), _
         Sheets("Hoja2").Range("A1").CurrentRegion, 2, 0)
Next
Application.ScreenUpdating = True
End Sub

 

También valdría:

Sub Buscaenhoja2(): On Error Resume Next
Application.ScreenUpdating = False
Sheets("Hoja1").Activate
For x = 1 To Range("A" & Rows.Count).End(xlUp).Row
   Cells(x, "B").Value = _
      WorksheetFunction.VLookup((Cells(x, "A").Value), Sheets("Hoja2").UsedRange, 2, 0)
Next
Application.ScreenUpdating = True
End Sub

 

Editado el por Antoni

publicado
  • Autor
hace 31 minutos , Antoni dijo:

También valdría:

Sub Buscaenhoja2(): On Error Resume Next
Application.ScreenUpdating = False
Sheets("Hoja1").Activate
For x = 1 To Range("A" & Rows.Count).End(xlUp).Row
   Cells(x, "B").Value = _
      WorksheetFunction.VLookup((Cells(x, "A").Value), Sheets("Hoja2").UsedRange, 2, 0)
Next
Application.ScreenUpdating = True
End Sub

 

graciasss!!

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.