'Application.Transpose stopped working when spreadsheet moved to anothe computer
I am running Office 365 on a Mac
I just got a new computer after old one died after I installed all my files from a backup one of .xlsm reports crashes with a "Run-Time error '1004': Application-defined or object-defined error" on the following line of code:
Results = Application.Transpose(wks.Range("BZ2:BZ" & LastRow).Value)
Is there a particular reference or include file I need to run this?
Here is the complete test Sub:
Sub GetDataTest()
' IDcust_Column will hold data from column "A"
Dim IDcust_Col() As Variant
' Results array will hold results
Dim Results() As Variant
Dim wkSh As Worksheet
Set wkSh = shCustomers
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Dim i As Long
' Initialize and fill arrays
' Initialize Results the correct number of blank cells from column "BZ"
Results = Application.Transpose(wks.Range("BZ2:BZ" & LastRow).Value)
' Initialize IDcust_Col all data from column "A"
IDcust_Col = Application.Transpose(wkSh.Range("A2:A" & LastRow).Value)
For i = LBound(Results) To UBound(Results)
' Do a bunch of stuff
Results(i) = IDcust_Col(i)
Next i
' Write results to column AC
wks.Range("AC2:AC" & LastRow).Value = Application.Transpose(Results)
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
