a = Application.match(Sheets("201507").Range("A" & i), Sheets("data").Range("D:D"), 0) ->一直出現問題
Set rangeFilledWithTransposedData = Sheets("201507").Range("e3:e31") ->不知如何可以變成變數, 對應201507的ID.
Sub match()
Dim i As Integer
Dim a As Integer
Dim transposedVariant As Variant
Dim sourceRowRange As Range
Dim sourceRowRangeVariant As Variant
Dim finalrow As Integer
a = Application.match(Sheets("201507").Range("A" & i), Sheets("data").Range("D:D"), 0)
Set sourceRowRange = Sheets("data").Range("H" & a & ":AL" & a)
sourceRowRangeVariant = sourceRowRange.Value
transposedVariant = Application.Transpose(sourceRowRangeVariant)
Dim rangeFilledWithTransposedData As Range
Set rangeFilledWithTransposedData = Sheets("201507").Range("e3:e31")
rangeFilledWithTransposedData.Value = transposedVariant