Macro matrices

Solo disponible en BuenasTareas
• Páginas : 2 (426 palabras )
• Descarga(s) : 0
• Publicado : 24 de mayo de 2011

Vista previa del texto
[pic]

Sub Macro1()
'
' Macro1 Macro
'
' Acceso directo: CTRL+h
'
' Macro que escribe la palabra camión usando una matriz de orden 5
Columns("A:AZ").Select
Selection.ColumnWidth = 3Range("A1:AG5").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
End With
Dim mat(5, 5) As String
Dim n, k As Integer DONDE K ES CONTADOR DE LAS COLUMNAS, ESTA CORRIENDO MAS RAPIDO EL INDICE DE LACOLUMNA
iniciar mat: letra_c mat: mostrar 1, 1, mat
iniciar mat: letra_a mat: mostrar 7, 1, mat
iniciar mat: letra_m mat: mostrar 13, 1, mat
iniciar mat: letra_i mat: mostrar 18, 1,mat
iniciar mat: letra_o mat: mostrar 23, 1, mat
iniciar mat: letra_N mat: mostrar 29, 1, mat
MsgBox " CAMION"
End Sub
Sub iniciar(m() As String) DONDE M ES LA MATRIZ
Dim n, k AsInteger
For n = 1 To 5
For k = 1 To 5
m(n, k) = " "
Next k
Next n
End Sub

Sub letra_c(m() As String)
Dim n, k As Integer
For n = 1 To 5
m(n, 1) = "#":
Next n
For k = 1 To 5m(1, k) = "#": m(5, k) = "#"
Next k
End Sub

Sub letra_a(m() As String)
Dim n, k As Integer
For n = 1 To 5
m(n, 1) = "#": m(n, 5) = "#"
Next n
For k = 1 To 5
m(1, k) ="#": m(3, k) = "#"
Next k
End Sub

Sub letra_m(m() As String)
Dim n, k As Integer
For n = 1 To 3
m(n, n) = "#"
Next n
k = 1
For n = 5 To 3 Step -1
m(k, n) = "#": k = k + 1
Next n
Forn = 1 To 5
m(n, 1) = "#": m(n, 5) = "#"
Next n
End Sub

Sub letra_o(m() As String)
Dim n, k As Integer
For n = 1 To 5
m(n, 1) = "#": m(n, 5) = "#"
Next n
For k = 1 To 5m(1, k) = "#": m(5, k) = "#"
Next k
End Sub

Sub letra_i(m() As String)
Dim n, k As Integer
For n = 1 To 5
m(n, 3) = "#":
Next n
End Sub

Sub letra_N(m() As String)
Dim n, k As Integer...