You are on page 1of 3

EXCEL MACROS

Private Sub CommandButton1_Click()

Call Limpiar

End Sub

Private Sub CommandButton2_Click()

Static x As Integer

fila = "b" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = TextBox1.Text

fila = "c" & x + 7

Range(fila).Select

If Me.OptionButton1.Value = True Then

ActiveCell.FormulaR1C1 = "A"

Else

If Me.OptionButton2.Value = True Then

ActiveCell.FormulaR1C1 = "B"

Else

ActiveCell.FormulaR1C1 = "C"

End If

End If

fila = "d" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = TextBox2.Text

fila = "e" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = TextBox3.Text

fila = "f" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = Val(TextBox4.Text)
fila = "g" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = Val(TextBox5.Text)

fila = "h" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = Val(TextBox6.Text)

fila = "i" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = Val(TextBox7.Text)

fila = "j" & x + 7

Range(fila).Select

ActiveCell.FormulaR1C1 = TextBox8.Text

x=x+1

End Sub

Private Sub CommandButton3_Click()

Unload Me

End

End Sub

Private Sub CommandButton4_Click()

Dim ex1, ex2, ex3 As Integer

Dim promedio As Single

ex1 = Val(Me.TextBox4.Text)

ex2 = Val(Me.TextBox5.Text)

ex3 = Val(Me.TextBox6.Text)

prom = (ex1 + ex2 + ex3) / 3

Me.TextBox7.Text = Str(prom)

If prom > 10 Then

Me.TextBox8.ForeColor = &HFF0000

Me.TextBox8.Text = "Aprobado"
Else

Me.TextBox8.ForeColor = &HFF&

Me.TextBox8.Text = "Desaprobado"

End If

End Sub

Private Sub OptionButton3_Click()

End Sub

Private Sub UserForm_Click()

Private Sub Limpiar()

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

TextBox5.Text = ""

TextBox6.Text = ""

TextBox7.Text = ""

TextBox8.Text = ""

Me.OptionButton1.Value = False

Me.OptionButton2.Value = False

Me.OptionButton3.Value = False

TextBox1.SetFocus

End Sub