You are on page 1of 2

Alineacin izquierda/derecha

Sub Ajustar_izq_der() If Selection.HorizontalAlignment = xlRight Then Selection.HorizontalAlignment = xlLeft Else Selection.HorizontalAlignment = xlRight End If End Sub

Convertir pesos a dolar


Sub Convertir() Set Area = Selection For Each Cell In Area z = Round(Cell / 4.16, 2) Cell.Value = z Cell.NumberFormat = "#,##0.00" Next Cell 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

Suprimir filas vacas


Sub SuprimirFilasVacias() LastRow = ActiveSheet.UsedRange.Row - 1 + _ ActiveSheet.UsedRange.Rows.Count For r = LastRow To 1 Step -1 If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete End If

Next r 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

Cambiar A1 a RC (columnas tiene nmeros en vez de letras)


Sub Rc() If Application.ReferenceStyle = xlR1C1 Then Application.ReferenceStyle = xlA1 Else Application.ReferenceStyle = xlR1C1 End If End Sub

Modificar paleta de colores


Sub Paleta() ActiveWindow.Zoom = 75 ActiveWorkbook.Colors(44) = RGB(236, 235, 194) ActiveWorkbook.Colors(40) = RGB(234, 234, 234) ActiveWorkbook.Colors(44) = RGB(236, 235, 194) End Sub

Mostrar todas las hojas


Sub MostrarHojas() Set wsHoja = Worksheets For Each wsHoja In ActiveWorkbook.Worksheets If wsHoja.Visible = False Then wsHoja.Visible = True End If Next wsHoja End Sub

You might also like