Captain_Jack_T
New Member
- Joined
- Nov 6, 2012
- Messages
- 27
Hi guys
I am using an array in order to copy the values of a some cells into another sheet. Does anyone know why it breaks? Thanks in advance!
I am using an array in order to copy the values of a some cells into another sheet. Does anyone know why it breaks? Thanks in advance!
Code:
Sub TrySomeArrays()
Dim RollerCoaster() As Variant
Dim Dimension1 As Long, Dimension2 As Long
Sheet1.Activate
Dimension1 = Range("A2", Range("B2").End(xlDown)).Cells.Count - 1
Dimension2 = Range("A2", Range("A2").End(xlToRight)).Cells.Count - 1
ReDim RollerCoaster(0 To Dimension1, 0 To Dimension2)
For Dimension1 = LBound(RollerCoaster, 1) To UBound(RollerCoaster, 1)
For Dimension2 = LBound(RollerCoaster, 2) To UBound(RollerCoaster, 2)
[COLOR=#daa520] Sheet2.Range("A1").Select
ActiveCell.Offset(Dimension1, Dimension2).Value = RollerCoaster(Dimension1, Dimension2).Value[/COLOR]
Next Dimension2
Next Dimension1
End Sub