procesamiento de datos
Varios Ejemplos de Macros
Alineación izquierda/derecha
Sub Ajustar_izq_der()
If (Selection.HorizontalAlignment = xlRight) ThenSelection.HorizontalAlignment = xlLeft
Else
Selection.HorizontalAlignment = xlRight
End If
End Sub
Convertir pesetas a euro
Sub Convertir()
Set Area = Selection
For Each Cell In Area
z =Round(Cell / 166.386, 2)
Cell.Value = z
Cell.NumberFormat = "#,##0.00"
Next Cell
End Sub
Pegar formato
Sub PegarFormato()
Selection.PasteSpecial Paste:=xlFormatsApplication.CutCopyMode = False
End Sub
Pegar valor
Sub PegarValor()
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End Sub
Dos decimales
Sub DosDec()
Dim Area AsRange
Set Area = Selection
For Each Cell In Area
z = Round(Cell, 2)
Cell.Value = z
Cell.NumberFormat = "#,##0.00"
Next Cell
End Sub
Separador de miles
SubSeparadorMil()
Dim Area As Range
Set Area = SelectionIf Area.NumberFormat = "#,##0" Then
Area.NumberFormat = "#,##0.00"
Else
Selection.NumberFormat = "#,##0"
End If
End SubSuprimir filas vacías
Sub SuprimirFilasVacias()
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
For r = LastRow To 1 Step -1
IfApplication.CountA(Rows(r)) = 0 Then
Rows(r).Delete
End If
Next r
End Sub
Autofilter
Sub FilterExcel()
Selection.AutoFilter
End Sub
Grids (Líneas de división)
Sub Grids()
IfActiveWindow.DisplayGridlines = True Then
ActiveWindow.DisplayGridlines = False
Else
ActiveWindow.DisplayGridlines = True
End If
End Sub
Cambiar A1 a RC (columnas tiene números en vez deletras)
Sub Rc()
If Application.ReferenceStyle = xlR1C1 Then
Application.ReferenceStyle = xlA1
Else
Application.ReferenceStyle = xlR1C1
End If
End Sub
Modificar paleta de...
Regístrate para leer el documento completo.