|
- #If VBA7 Then
- ' 64位和32位兼容的声明
- Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
- #Else
- ' 仅32位的声明
- Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
- #End If
- Sub test() '//数组部分复制
- Dim arr, brr, i&, j&
- arr = [a1:d30]
- ReDim brr(1 To 20, 1 To 2)
- '取第2~3列的第11~20行数据给brr数组
-
- sArch = LCase(Environ("PROCESSOR_ARCHITECTURE"))
- If sArch = "amd64" Then ' 对于64位Office,检查PROCESSOR_ARCHITECTURE是否为amd64
- num = 24
- ElseIf sArch = "x86" Then ' 对于32位Office,检查PROCESSOR_ARCHITECTURE是否为x86
- num = 16
- End If
-
- For i = 1 To 2
- CopyMemory brr(1, i), arr(11, i + 1), 20 * num '单元格数组每个元素占24个字节
- Next i
- [f1].Resize(20, 2) = brr
- End Sub
复制代码 |
|