Está en la página 1de 2

Option Explicit

'Esto es un comentario
Dim contenido As Integer
Dim calif As Double
calif = 4.2
Sub MiPrimeraMacro()
'Aca se ponen las operaciones
End Sub
Sub mensaje()
Dim num As Integer
num = 3
MsgBox "hola mundo:" & num, , "buenas"
End Sub
Sub leercelda()
contenido = Range("A1").Value
o 'contenido=cells(1,1)
End Sub

Sub asignarValor()
Range("A1").Value = 788
'dim valor as integer valor =788
'Range("A2").Value=valor
'Range("A2").value=Range("A1").value
End Sub

Sub leer()
Dim i As Integer
For i = 1 To 20
nota = Range("B2:B21").Cells(i, 1).Value
Next i
End Sub

Sub ciclos()
For i = 1 To 20
nota = Range("B2:B21").Cells(i, 1).Value
MsgBox "la nota" & i & "es: " & nota
If nota >= 3 Then
Range("C2:C21").Cells(i, 1).Value = "APROB"
Else
Range("C2:C21").Cells(i, 1).Value = "REPROB"
End If
Next i
End Sub

Sub recorrerArreglo ()
Dim numeros(1 to 3,1 to 3) as integer
Dim i as integer
Dim j as integer
For i= 1 to 3
For j= 1 to 3
numeros(i,j)=Range("A1:C5").Cells(i,j)
next j
Next i
End sub

Sub bubblesort() 'Ordenamiento burbuja


Dim i as integer
Dim j as integer
Dim temporal as integer
For i= 1 to 5
For j= i + 1 to 5
If (numero(i) > numeros(j)) Then
Temporal=numeros(i)
Numeros(i) = numeros(j)
Numeros(j)=temporal
End If
Next j
Next i
End Sub

También podría gustarte