excel sheet的 某列(m*n行) 快速复制到 m行n列区域
'以下代码可以利用非循环的方式,实现把[a1:a12]的数据快速复制到[b1:e3]:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Sub xxx()
Dim arr1(), arr2(1 To 3, 1 To 4)
arr1 = Range("a1:a12")
CopyMemory ByVal VarPtr(arr2(1, 1)), ByVal VarPtr(arr1(1, 1)), 12 * 16'variant需要16个字节存储空间
Range("b1:e3") = arr2
End Sub