Escolar Documentos
Profissional Documentos
Cultura Documentos
EXCEL
El formador dice y el estudiante hace
Abra el Editor de Visual Basic para aplicaciones y realice estas macros aplicadas tanto a libros
como a rangos de hojas
Sub limpia_celdas()
Selection.Clear
End Sub
Sub copiar_rango()
Set rangox = Selection
Selection.Copy
Sheets("hoja3").Select
Range("a3").Select
ActiveSheet.Paste
Sub BUSCA_REEMPLAZA()
Se debe de
configurar la
propiedad
ROWSOURCE:
con la lista de
DEPORTES y
copiar la carpeta
IMAG en la
misma ubicacin
del formulario
en los datos de
Sub ACTUALIZA_INVENTARIO()
Sheets("MOVIMIENTO").Select
Range("A2").Select
Do Until ActiveCell = ""
varCOD = ActiveCell
varMOV = ActiveCell.Offset(0, 2)
varCANTIDAD = ActiveCell.Offset(0, 3)
Sheets("KARDEX").Select
Sub aplica_funciones()
Dim prom As Double
Dim suma As Double
'Aqu de acuerdo a la seleccin de celdas genera la sumatoria y _
el promedio de la misma
prom = Application.WorksheetFunction.Average(Selection)
suma = Application.WorksheetFunction.Sum(Selection)
'Esta instruccin muestra por pantalla en un cuadro de dilogo _
la sumatoria y el promedio una debajo de la otra
MsgBox "LA SUMA TOTAL ES:..." & suma & Chr(13) & _
"EL PROMEDIO ES:..." & prom
End Sub
Sub selecciona_hoja()
Sheets("hoja1").Select
ActiveSheet.Next.Select
Range("a2") = ActiveSheet.Name
Range("a3") = ActiveSheet.Index
End Sub
Sub cabeceras_tabla()
Columns("A:D").Select
Selection.ColumnWidth = 16
Range("A1").Select
ActiveCell.FormulaR1C1 = " NOMBRE"
Range("B1").Select
ActiveCell.FormulaR1C1 = " APELLIDO"
Range("C1").Select
ActiveCell.FormulaR1C1 = " CEDULA"
Range("D1").Select
ActiveCell.FormulaR1C1 = " PROGRAMA"
Range("A2").Select
End Sub
Sub crear_rotulos()
Range("A3").Select
'Esta instruccin coloca el titulo de la hoja
ActiveCell.Value = " INSTITUTO COLOMBIANO DE APRENDIZAJE - INCAP"
'Esta instruccin formatea el texto colocado en la celda A3
With Selection.Font
.Name = "Broadway"
.FontStyle = " Bold Italic"
.Size = 14
End With
End Sub
Sub mensaje_pregunta()
RESPUESTA = MsgBox("DESEA TERMINAR LABORES..", vbYesNo + vbQuestion, _
" CONFIRMACION DE SALIDA")
If RESPUESTA = vbYes Then
MsgBox " GUARDE LA INFORMACION ANTE DE SALIR!!", vbExclamation
Application.Quit
Else
MsgBox " NO SE GUARDO INFORMACION", vbCritical
End If
End Sub
Sub guardadirecc()
Dim lugar1 As String, lugar2 As String
Range("B3").Select
lugar1 = ActiveCell.Address
'guarda la referencia absoluta
lugar2 = ActiveCell.Address(False, False)
'guarda la referencia relativa
'devuelve en C3 las 2 direcciones concatenadas
Range("C3").Value = lugar1 & "-" & lugar2
End Sub
Sub mensaje()
MsgBox "Texto del mensaje", vbOKOnly + vbInformation, "Titulo del Mensaje"
End Sub
Sub pregunta()
Sub RANGO_ASIGNAR()
Dim VALOR As Integer
Dim CELDA As Range
'Esta instruccin recorre toda la columna B y le asigna el _
valor digitado por teclado
For Each CELDA In ActiveSheet.Range("B2:B4")
VALOR = Val(InputBox("INGRESE VALOR"))
CELDA.Value = VALOR
Next CELDA
End Sub
Sub actualiza_SALDO()
Dim buscar As Range
Dim filaes As Integer
Dim saldo As Range
'Esta instruccion selecciona la hoja 2
ActiveWorkbook.Sheets(2).Activate
'Esta instruccin asigna el nro. de factura _