I have a VBA code that gets data from a column of a structured table and puts it in a column of another structured table like this:
Dim TopNTickers As Variant
Dim NoOfTickers As Integer
Dim OutputTickers As Range
TopNTickers = Application.Transpose(Range("PortfolioTbl[Ticker]"))
NoOfTickers = UBound(TopNTickers)
With Range("TopNTickersTbl").ListObject.ListColumns("Ticker").Range
Set OutputTickers = .Parent.Range(.Cells(2, 1), .Cells(NoOfTickers + 1, 1))
End With
OutputTickers = Application.Tranpose(TopNTickers)
The first Transpose worked fine. It copied the data from the Ticker column of PortfolioTbl table into the 1D TopNTickers array.
The next part selects a subset of the Ticker column of the TopNTickersTbl table. It seems to work fine.
The last part gives me error:
Object doesn't support property or method
I have also tried to replace OutputTickers with OutputTickers.Value but the same error is there.
Note:
The code above has been simplified. In its real version, I had a few other lines that deleted the content of TopNTickersTbl then add the number of lines to it equal to the size of the array TopNTickers, in preparation for the data-write-out stage. The same error happened in both versions, and I am quite sure the extra code is not related to this error.