miércoles, 7 de julio de 2010

excel avanzado

visual basic


Function eval(x)
If x < 4 Then eval = "reprobado"
If x = 4 Or x = 5 Then eval = "aprobado"
If x = 6 Or x = 7 Then eval = "bueno"
If x = 8 Or x = 9 Then eval = "distinguido"
If x = 10 Then eval = "sobresaliente"
End Function

Function gradosf(g)
gradosf = g * 9 / 5 + 32

End Function

Function gradosc(g)
gradosc = 5 / 9 * (g - 32)

End Function

Function emocional(dia, nacimiento)
edad = dia - nacimiento
Pi = 3.141592654
T = 28
emocional = Sin(2 * Pi / T * edad)

End Function

Function fisica(dia, naciemiento)

edad = dia - nacimiento
Pi = 3.141592654
T = 23
fisica = Sin(2 * Pi / T * edad)

End Function

Function intelectual(dia, naciemiento)

edad = dia - nacimiento
Pi = 3.141592654
T = 33
intelectual = Sin(2 * Pi / T * edad)

End Function

Sub colores()
c = Range("i17").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f17").Interior.ColorIndex = x


c = Range("i18").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f18").Interior.ColorIndex = x


c = Range("i19").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f19").Interior.ColorIndex = x

c = Range("i20").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f20").Interior.ColorIndex = x


c = Range("i21").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f21").Interior.ColorIndex = x


c = Range("i22").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f22").Interior.ColorIndex = x



c = Range("i23").value
If c > 0 Then x = 8
If c > 0.25 Then x = 41
If c > 0.5 Then x = 4
If c > 0.75 Then x = 10
If c = 1 Then x = 48
Range("f23").Interior.ColorIndex = x

End Sub

Sub color()
a = Array(0, 0.2, 0.55, 0.9, 1, 8, 41, 4, 10, 48)
For i = 17 To 23
For j = 0 To 4
If Range("i" & i).value >= a(j) Then
Range("f" & i).Interior.ColorIndex = a(j + 5)
End If
Next
Next
End Sub

No hay comentarios:

Publicar un comentario