Beruflich Dokumente
Kultur Dokumente
Manejo de Rangos de tablas Para sealar una tabla se hace con CurrentRegion. Un ejemplo: Sub Marcar_tabla() Dim R As Range Dim filas As Long Set R = Range("A1").CurrentRegion filas = R.Rows.Count MsgBox Nro. Filas : & & filas End Sub Macro que reemplaza una palabra por otra en todas las hojas Sub RemplazarPalabra() Dim Palabra As String Dim Hoja As Long Palabra = Trim(InputBox("Introduzca la palabra a buscar: ")) For Hoja = 1 To Sheets.Count Sheets(Hoja).Activate Cells.Replace What:=Palabra, Replacement:="" Next Hoja En este caso reemplazamos por "", lo que supone borrar la palabra buscada. End Sub .
Sub limpia_celdas() Selection.Clear End Sub Sub copiar_rango() Set rangox = Selection Selection.Copy Sheets("hoja3").Select Range("a3").Select ActiveSheet.Paste End Sub Sub buscar_datos() Dim buscar As String buscar = InputBox(" ESCRIBE EL TEXTO: ", "BUSCAR TEXTO") Range("A1").Select While ActiveCell.Value <> "" If ActiveCell.Value <> buscar Then ActiveCell.Offset(1, 0).Select Else MsgBox "NOMBRE ENCONTRADO" Exit Sub
Sub BUSCA_REEMPLAZA() ' Primero hay que seleccionar el rango de texto a aplicar BSQUEDA Dim sw As Integer Dim txtbus As String Dim txtreemp As String sw = 0 Set RANGOBUSCAR = Selection ' DIGITE EL TEXTO A BUSCAR Y EL TEXTO A REEMPLAZAR txtbus = InputBox("DIGITE EL CLIENTE A BUSCAR", "BUSCAR INFORMACION") txtreemp = InputBox(" DIGITE POR CUAL NOMBRE VA A REEMPLAZAR", "REEMPLAZAR") Application.ScreenUpdating = False 'EN ESTA INSTRUCCION RECORRE CELDA POR CELDA DEL RANGO SELECCIONADO _ Y AL LOCALIZARLA LA REEMPLAZA For Each CELDA In RANGOBUSCAR If CELDA.Value = txtbus Then CELDA.Value = Replace(CELDA.Value, txtbus, txtreemp) sw = 1