Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/11/2008, 07:44
ebu
 
Fecha de Ingreso: noviembre-2008
Mensajes: 153
Antigüedad: 15 años, 6 meses
Puntos: 0
redimensionar una array tipo type

buenas, haber si me pueden ayudar con esto.
he diseñado una matriz tipo type de esta manera:
Private Type datos
nombre As String
cantidad As Integer
confi As String
End Type

Dim matrix() As datos

el diferentes procedimientos voy llenando la matriz:
ReDim Preserve matrix(k)
matrix(k).nombre = variable
k = k + 1

.....


ReDim Preserve matrix(k)
matrix(k).cantidad = can
...
For i = 0 To UBound(vConfigName)
ReDim Preserve matrix(i)
matrix(i).confi = vConfigName(i)
Next i

y cuando lo voy a visualizarlo en la hoja excel la matriz, matrix se encuentra vacio.
xq puede ser?? el fallo puede estar a la hora de redimensionar la matriz. gracias!


Dim i As Integer, j As Integer, cont As Integer, cont2 As Integer

For i = 0 To UBound(matrix)'matrix vacio
cont = matrix(i).cantidad
Range("A2").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(0, 1).Select
Loop
Do Until cont = cont2
ActiveCell.FormulaR1C1 = matrix(i).nombre
ActiveCell.Offset(0, 1).Select
cont2 = cont2 + 1
Loop

For j = 1 To cont
Range("B2").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.FormulaR1C1 = matrix(j).confi
Next j
Next i

otra cosita saben si existe algun otro modo para escribir en una celda de excel aparte de este modo ActiveCell.FormulaR1C1 = matrix(j).confi. sq a veces se me para ai.