lunes, 11 de julio de 2022

Formato en macro

Formato en macro

' Formato de color

        Range("a1").Interior.ColorIndex = 56

        Range("a2").Interior.Color = VBA.vbRed

        Range("a3").Interior.Color = 122

        Range("a4").Interior.Color = VBA.RGB(125, 1, 255)

    

'Formato de ancho

    Columns("A:A").ColumnWidth = 3.71

   

' Formato de decimales

    Columns("H:K").Select

    Selection.Style = "Comma"


' formato fecha

    Columns("E:E").Select

    Selection.NumberFormat = "m/d/yyyy"


' Agrupación de columnas

    Columns("P:P").Select

    Selection.Columns.Group

    

'AGRUPAR

    

    ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1

    

        

' Cambiar texto

    Range("a1:a1").Select

    ActiveCell.FormulaR1C1 = "AÑO"

    

'INSERTAR FILA   

    Rows("1:1").Select

    Selection.Insert Shift:=xlDown


'MENSAJE EN UNA CELDA

    Range("H1").Select

    ActiveCell.FormulaR1C1 = "Meidbook te da la  bienvenida"

    

'SUBTOTAL EN FORMULA


    Range("H2").Select

    Application.CutCopyMode = False

    ActiveCell.FormulaR1C1 = "=+SUBTOTAL(9,R[5]C:R[1048574]C)"

    Range("H2").Select

    Selection.Copy

    Range("I2:k2").Select

    ActiveSheet.Paste

    Range("H2").Select

    Selection.Copy

    Range("bo2").Select

    ActiveSheet.Paste

    

    

'SUMA FORMULA


    Range("H3").Select

    Application.CutCopyMode = False

    ActiveCell.FormulaR1C1 = "=+SUM(R[4]C:R[1048573]C)"

'Para copiar la formula a otras celdas

    Range("H3").Select

    Selection.Copy

    Range("I3:k3").Select

    ActiveSheet.Paste

     Range("H3").Select

    Selection.Copy

    Range("bo3").Select

    ActiveSheet.Paste

    Application.CutCopyMode = False

    ActiveWindow.SmallScroll Down:=-27

    

'INMOVILIZAR PANELES


    Range("H6").Select

    ActiveWindow.FreezePanes = True

    

'ELIMINAR LAS LINEAS

    ActiveWindow.DisplayGridlines = False

    Range("H1").Select


No hay comentarios:

Publicar un comentario

Macro Meidbook

Cap. 8 - Acelera tu aprendizaje en objetos, propiedades y métodos Cap. 9 - Referencia y escritura en celdas, rangos, filas y columnas Cap. 1...