Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/07/2008, 14:49
Avatar de mrocf
mrocf
 
Fecha de Ingreso: marzo-2007
Ubicación: Bs.As.
Mensajes: 1.103
Antigüedad: 17 años, 1 mes
Puntos: 88
Respuesta: Buscar V avanzado

Hola! MONIFER.

a) Mientras mantienes presionada la tecla Alt, presiona la techa F8.

b) En Nombre de la Macro introduce: Prueba

c) Te aparecerá el siguiente texto:

Código:
Sub Prueba()

End Sub
que reemplazarás totalmente por este otro:

Código:
Sub BuscarTextoEnLibro()

Dim MiWord As String, FirstFind As String, MiMsg As String
Dim MiCell As Range, MiRangoActivo As String

MiWord = InputBox("Ingrese texto a buscar"): If MiWord = "" Then Exit Sub
MiRangoActivo = Selection.Address(External:=True)

For Each MiSheet In ActiveWorkbook.Sheets
  FirstFind = ""
Do
  If FirstFind = "" Then
    Set MiCell = MiSheet.Cells.Find(What:=MiWord, LookIn:=xlValues, _
      LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False)
    If MiCell Is Nothing Then GoTo S02
    FirstFind = MiCell.Address
  Else
    Set MiCell = MiSheet.Cells.FindNext(MiCell)
    If MiCell.Address = FirstFind Then GoTo S02
  End If
  
  Application.Goto MiCell
  MiMsg = "Se encuentra en la hoja """ & ActiveSheet.Name & """." & _
    Chr(10) & Chr(10) & "¿ Desea continuar ?"
  
  If MsgBox(MiMsg, vbYesNo, "Buscando el texto: """ & MiWord & """") = 7 Then
      Set MiCell = Nothing
      Exit Sub
  End If
    
Loop
  
S02:
Next MiSheet

Application.Goto Range(MiRangoActivo)
Set MiCell = Nothing
End Sub
d) Cierra todas las ventanas del ambiente Visual Basic for Application en el que te encuentras y retorna al Excel.

e) Asigna un botón para la macro recién incorporada: BuscarTextoEnLibro.

Espero que te sea útil.



Última edición por mrocf; 25/09/2008 a las 12:28 Razón: depuración