I am used to assigning ranges to arrays. However, for some reason right now I am constantly getting an application or object defined error (the first code line below). The second line below works fine. It is identical to the first line except I just copy the range showing all the variables exist.
I have checked in the watch window, arrActuals is Variant/Variant(). Adding .Value at the end of the first line did not solve the error either. Any ideas on why this is happening?
arrActuals = wkbOVHFile.Sheets(szAOPPage).Range(Cells(iStartCopy, IntActOVHCol), Cells(iEndCopy, IntActOVHCol))
wkbOVHFile.Sheets(szAOPPage).Range(Cells(iStartCopy, IntActOVHCol), Cells(iEndCopy, IntActOVHCol)).Copy
arrActuals = wkbOVHFile.Sheets(szAOPPage).Range(wkbOVHFile.Sheets(szAOPPage).Cells(iStartCopy, IntActOVHCol), wkbOVHFile.Sheets(szAOPPage).Cells(iEndCopy, IntActOVHCol)).Value. To avoid such long lines (improve readability), rather use variables e.g.:Dim ws As Worksheet: Set ws = wkbOVHFile.Sheets(szAOPPage)and then doarrActuals = ws.Range(ws.Cells(iStartCopy, IntActOVHCol), ws.Cells(iEndCopy, IntActOVHCol)).Value.