miércoles, 28 de marzo de 2012

Cambio de Color y estructura con un Boton de Visual Basic

Ahora utilizaremos de forma sencilla un boton de formulario en conjunto con macros grabadas.
Primero grabaremos una macro, en la hoja pondremos un formato decorado:

Ahora teniendo la primera macro grabada, grabaremos la segunda macro, le cambiaremos la estructura el color y el sombreado etc.

Por ultimo crearemos la tercera macro, a esta tambien le cambiaremos la fuente el color el sombreado y el fondo.

Pondremos unos indicadores:

Ahora nos vamos a la opcion programador, elegimos insertar y por ulitmo insertar boton de formulario.


Ahora ya teniendo el boton le damos doble clic, he ingresamos a Visual Basic y creamos un modulo.
Utilizaremos el condicional IF
Sub estilo()
If [d2] = 1 Then
 Range("A9:E9").Select
    Selection.Font.Size = 12
    Selection.Font.Size = 14
    Selection.Font.Size = 16
    Selection.Font.Size = 18
    Selection.Font.Size = 20
    Selection.Font.Size = 22
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent2
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    Selection.Font.Bold = True
    With Selection.Font
        .Name = "Aharoni"
        .Size = 22
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
    Range("A10:A16").Select
    Selection.Font.Size = 12
    Selection.Font.Size = 14
    Selection.Font.Size = 16
    Selection.Font.Size = 18
    Selection.Font.Size = 16
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = 0.799981688894314
        .PatternTintAndShade = 0
    End With
    Range("A10:A16").Select
    Selection.Font.Bold = True
    Range("B10:E16").Select
    With Selection.Font
        .Name = "Adobe Hebrew"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent6
        .TintAndShade = -0.499984740745262
        .PatternTintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent6
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    Range("B10:E16").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Range("B10").Select
        End If
       
    If [d2] = 2 Then
    Range("A9:E9").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent1
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    Selection.Font.Size = 24
    Selection.Font.Size = 26
    Selection.Font.Size = 24
    Selection.Font.Size = 22
    Selection.Font.Size = 20
    Selection.Font.Size = 18
    Selection.Font.Italic = True
    With Selection.Font
        .Name = "Hobo Std"
        .Size = 18
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
    Range("A10:A16").Select
    Selection.Font.Bold = False
    Selection.Font.Italic = True
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark2
        .TintAndShade = -0.249977111117893
        .PatternTintAndShade = 0
    End With
    Range("B10:E16").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent5
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("B9:E9").Select
    Selection.Font.Size = 16
    Selection.Font.Size = 14
    Range("G14").Select
    ActiveWindow.SmallScroll Down:=-15
    End If
    If [d2] = 3 Then
     Range("A9:E9").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    With Selection.Font
        .Color = -16776961
        .TintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("A10:A16").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark2
        .TintAndShade = -0.899990844447157
        .PatternTintAndShade = 0
    End With
    With Selection.Font
        .Color = -16776961
        .TintAndShade = 0
    End With
    With Selection.Font
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
    End With
    Range("B10:E16").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark2
        .TintAndShade = -0.899990844447157
        .PatternTintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent3
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent2
        .TintAndShade = 0.399975585192419
        .PatternTintAndShade = 0
    End With
    Range("A10:A16").Select
    With Selection.Font
        .Name = "Comic Sans MS"
        .Size = 16
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
    End With
    Columns("A:A").ColumnWidth = 16.57
    Range("G15").Select
    Columns("B:B").ColumnWidth = 14.71
    Columns("C:C").ColumnWidth = 12.71
    Columns("D:D").ColumnWidth = 13.71
    Columns("E:E").ColumnWidth = 18.14
    Columns("E:E").ColumnWidth = 14.86
    End If
   
End Sub



 Y por ultimo copiamos las macros













martes, 27 de marzo de 2012

Sistema de Facturación utilizando Visual Basic

primeramente explicaremos que el sistema de facturación lo realizaremos utilizando las formulas antes vistas "=BUSCARV( )" "=INIDICE( )" entre otras.
Primero haremos el formato de la factura

Ahora añadiremos las formulas:




Y sobretodo muy importante! crear una base de datos, y esta se llamara Productos

Ahora ya teniendo el libro con el sistema de facturación crearemos el sistema de cotización






AHORA CREAREMOS LAS VENTANAS CON LA AYUDA DE USERFORM




miércoles, 29 de febrero de 2012

SISTEMA DE ASISTENCIA

  1. Primero crearemos una base de datos, esta estara conformada por, CODIGO, NOMBRE, GRADO Y CARRERA

2. Ahora ya creada la base de datos, nos dirijiremos a la hoja 1, ahi pondremos CODIGO, NOMBRE, GRADO, CARRERA, HORA, FECHA Y CODIGO nuevamente.


3. Ahora nos ubicamos en la fila 20 y copiamos los mismos datos que la fila anterior.
4. Ahora, nos dirigimos nuevamente a la fila 1, y empezamos a colocar y a utilizar las formulas aprendidas anteriormente(=BUSCARV(), =SI( ), =HOY( ), =AHORA( ) ETC)

A) CODIGO: =VAL(G2)

B) Ahora en la celda del nombre, buscaremos la informacion la base de datos anterior, la matriz de llama "DATOS".

 C) Ahora utilizaremos la misma formula para buscar valor solo variando numero de fila.

D)  Se utiliza la misma formula en CARRERA, variando siempre el numero de fina de la matriz

E) En la fecha se va a utilizar la formula =AHORA()

F) La formula para la fecha es =HOY( )
G) Ahora en la celda G2 ingresaremos algun codigo de la base de datos

Formato de asistencia

La asistencia en un establecimiento es muy importante, y que mejor que hacerlo de una manera practica, sistematica y exacta.
Entonces aqui podemos poner nuestros concocimentos de visual basic en practica.
Crearemos un sistema de asistencia utilizando lo que hemos aprendido sobre Visual Basic,
es un reto pero nada es imposible!!!!

Codigos que se pueden utilizar en excel

  • Pegar:
Avtivesheet.paste

  •  
formato asistencia