Código: Seleccionar todo
Option Explicit
Sub Sumando2()
Dim mDatos() As variant
Dim iSuma As Integer
Dim co1 as integer
Dim txt as variant
for co1 = 10 to 90 step 10
txt = txt & co1 & ","
next
msgbox txt
'Llenamos la matriz con la funcion Array 'mDatos() = Array(10,20,30,40,50,60,70,80,90)
mDatos() = Array(txt)
msgbox txt
'Intentamos sumar la matriz
iSuma = SumaMatriz( mDatos() )
MsgBox Str( iSuma )
End Sub
Function SumaMatriz ( Datos() As variant ) As Integer
Dim co1 As Integer
For co1 = LBound( Datos() ) To UBound( Datos() )
SumaMatriz = SumaMatriz + Datos( co1 )
Next
End Function