Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Para responder esta pregunta, primero mencionaremos los formatos que utilizaremos:
Ahora, para poder manipular los formatos mencionados mediante VBA en la hoja de Excel crearemos un panel de control colocando los principales cambios que deseamos
tener.
a) Arial
b) Arial Black
c) Cooper Black
d) Calibri
e) Century gothic
g) Comic Sans MS
Utilizando la siguiente codificación para cada tipo de fuente, cambiando solo el .Name=»Agregar el tipo de fuente que deseemos«:
Sub ARIAL()
‘ ARIAL Macro
Range(«I9:L14»).Select
With Selection.Font
.Name = «Arial»
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.COLOR = -10477568
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub
Sub APLICARNEGRITA()
‘ APLICARNEGRITA Macro
Range(«I9:L14»).Select
Selection.Font.Bold = True
End Sub
Sub QUITARNEGRITA()
‘ QUITARNEGRITA Macro
Range(«I9:L14»).Select
Selection.Font.Bold = False
End Sub
También modificaremos los colores del texto, así que agregaremos pequeños botones circulares de colores para que al presionarlos cambie el color del texto:
Sub COLORAZUL()
‘ COLORAZUL Macro
Range(«I9:L14»).Select
With Selection.Font
.COLOR = -10477568
.TintAndShade = 0
End With
End Sub
Sub ALINEARALADERECHA()
‘ ALINEARALADERECHA Macro
Range(«I9:L14»).Select
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
End Sub
Sub tamaño30()
‘ tamaño30 Macro
Range(«I9:L14»).Select
With Selection.Font
.Size = 30
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.COLOR = -10477568
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub
Manipular Formatos
Publicaciones Relacionadas:
Categories: Conceptos básicos de macros, mejores macros, Tips de Excel Avanzado, Trucos de Excel Avanzado, Uso de Rangos con Macros, With en VBA Excel | Tags:
¿Cómo cambiar el tipo de fuente en excel?, ¿Cómo modificar el tamaño de la letra con VBA?, ¿Cómo se pueden manipular formatos con VBA?, ¿Qué formatos puedo
modificar con VBA?, ¿Se puede modificar un texto en excel? | Permalink
Deja un comentario
Message *
Nombre *
Correo electrónico *
Publicar comentario