Hi guys I can't figure this one out. (I'm a novice) I really want to learn to use arrays to and from ranges because it will be much faster than the looping methods I currently use. I searched the forum but see nothing exactly like my problem. The code I pasted is part of one of my procedures and the last line generates a "Run Time error 1004... Application defined or Object defined error". I did some test code with a range format of "A2:D2" and it works, writing perfectly where I direct it. However I need to access the range with cell variable references and that code doesn't work. You'll see below. I'm going nuts with this one. Most of the time it's something silly that I did and can figure it out. When I finally get this thing working how I want, it will manipulate large amounts of data and speed will be critical. Please help.
Dave H.
Public Sub VTest()
Dim RcInfoArr() As Variant
Dim I As Integer
Dim X As Integer
ReDim RcInfoArr(3)
For X = 0 To 3
RcInfoArr(X) = Cells(X + 1, "C").Value
Next X
I = 0
Do
I = I + 1
Loop Until Workbooks("Stats").Worksheets("PO1sts").Cells(I, "A").Value = ""
'The line below works fine
Workbooks("Stats").Sheets("PO1sts").Range("A2:D2").Value = RcInfoArr
X = 0
'This line doesn't
Workbooks("Stats").Worksheets("PO1sts").Range(Cells(I, X + 1), Cells(I, X + 4)).Value = RcInfoArr
Dave H.
Public Sub VTest()
Dim RcInfoArr() As Variant
Dim I As Integer
Dim X As Integer
ReDim RcInfoArr(3)
For X = 0 To 3
RcInfoArr(X) = Cells(X + 1, "C").Value
Next X
I = 0
Do
I = I + 1
Loop Until Workbooks("Stats").Worksheets("PO1sts").Cells(I, "A").Value = ""
'The line below works fine
Workbooks("Stats").Sheets("PO1sts").Range("A2:D2").Value = RcInfoArr
X = 0
'This line doesn't
Workbooks("Stats").Worksheets("PO1sts").Range(Cells(I, X + 1), Cells(I, X + 4)).Value = RcInfoArr