I'm trying to transfer data from workbook x into workbook y. I want to copy a horizontal range from workbook x, transpose and reverse the range and then paste the values in workbook y. I would it to look like this:
Workbook x
ColumnX | ColumnXx | ColumnXy | ColumnXz |
---|---|---|---|
9 | 8 | 10 | 7 |
Workbook y
Column |
---|
7 |
10 |
8 |
9 |
So far, I can transpose the values but I've been searching how to reverse the range and haven't found any solutions using VBA. My current code:
Dim x As Workbook
Dim y As Workbook
Dim vals As Variant
Set y= ThisWorkbook
Set x= Workbooks.Open("FileName.xls", CorruptLoad:=XlCorruptLoad.xlRepairFile)
vals = x.Sheets("SheetSource").Range("G10:C10").Value
y.Sheets("Sheet1").Range("G8:G12").Value = WorksheetFunction.Transpose(vals)