Professional Documents
Culture Documents
Macros de Excel
Macros de Excel
Sub Ajustar_izq_der() If Selection.HorizontalAlignment = xlRight Then Selection.HorizontalAlignment = xlLeft Else Selection.HorizontalAlignment = xlRight End If End Sub
Pegar formato
Sub PegarFormato() Selection.PasteSpecial Paste:=xlFormats Application.CutCopyMode = False End Sub
Pegar valor
Sub PegarValor() Selection.PasteSpecial Paste:=xlValues Application.CutCopyMode = False End Sub
Dos decimales
Sub DosDec() Dim Area As Range 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
Sub SeparadorMil() Dim Area As Range Set Area = Selection If Area.NumberFormat = "#,##0" Then Area.NumberFormat = "#,##0.00" Else Selection.NumberFormat = "#,##0" End If End Sub
Autofilter
Sub FilterExcel() Selection.AutoFilter End Sub
Grids
Sub Grids() If ActiveWindow.DisplayGridlines = True Then ActiveWindow.DisplayGridlines = False Else ActiveWindow.DisplayGridlines = True End If End Sub