Jump to content

necesito ayuda en Visual Basic (macro, en excel)


<<Rorro>>

Recommended Posts

bueno, estaba revisando los apuntes y me puse a hacer algunos ejercicios, en una de esas me pedian hacer una tabla que pudiera registrar las notas del curso, mas o menos tiene que ser asi, atraves de un boton (command button), al hacer, tiene que aparecer un TextBox para ingresar los datos, que son el nombre, el rut, las notas de las asignaturas, y tiene que haber un boton que al apretar me calcule todos los promedios, y tiene que decir si aprobo (con color azul) y reprobo (con color rojo), para pasar el promedio tiene que ser mayor a 4

 

tengo una duda con el promedio solamente, me tira errores, todo lo demas me funciono

 

 

Private Sub CommandButton1_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 1).Value = InputBox("Ingresar nombre de los alumnos", "Ingreso de nombres")

 

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton2_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 2).Value = Val(InputBox("Ingrese el RUT de los alumnos", "Ingreso del RUT"))

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton3_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 3).Value = Val(InputBox("Ingrese notas de lenguaje y comunicación", "Notas de Lenguaje y Comunicación"))

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton4_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 4).Value = Val(InputBox("Ingrese notas de matemáticas", "Notas de Matemáticas"))

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton5_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 5).Value = Val(InputBox("Ingrese notas de ciencias naturales", "Notas de Ciencias Naturales"))

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton6_Click()

 

Dim fila As Integer

 

fila = 3

 

While fila <> 11

 

Cells(fila, 6).Value = Val(InputBox("Ingrese notas de historia", "Notas de Historia"))

 

fila = fila + 1

 

Wend

 

End Sub

 

Private Sub CommandButton7_Click()

 

Dim promedio As Double

Dim suma As Double

 

suma = 0

 

While fila <> 11

 

suma = Cells(fila, 3).Value + Cells(fila, 4).Value + Cells(fila, 5).Value + Cells(fila, 6).Value

promedio = suma / 4

 

fila = fila + 1

 

Wend

 

 

End Sub

 

Private Sub CommandButton8_Click()

 

Dim fila As Integer

 

fila = 3

 

For fila = 3 To 10

 

Cells(fila, 1).Value = ""

Cells(fila, 2).Value = ""

Cells(fila, 3).Value = ""

Cells(fila, 4).Value = ""

Cells(fila, 5).Value = ""

Cells(fila, 6).Value = ""

 

Next

End Sub

 

 

y aca les dejo como se ve en excel

 

http://www.(Palabra Censurada, BOT dañino)/imagen-ejemo-6761007.html

 

donde dice estado, es donde debe decir si aprobo o reprobo

ojala me puedan ayudar, y si hay una sugerencia para hacerla mas corta, bienvenido sea

Edited by <<Rorro>>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...