excel VBA 请教高手,把A1:A10单元格显示改成A1:P1单元格显示,咋改呀
发布网友
发布时间:2022-05-05 10:51
我来回答
共2个回答
热心网友
时间:2023-10-05 13:59
Sub vba不重复随机数()
Dim i As Long
i = 100
Dim num As Long
ReDim arr(i) As Long
ReDim Arr2(i) As Long
Dim x As Long
For x = 0 To i
arr(x) = x
Next x
For x = 0 To i
num = Int(Rnd() * (i - x))
Arr2(x) = arr(num)
arr(num) = arr(i - x)
Next x
Range("A1:P1") = Arr2
End Sub
热心网友
时间:2023-10-05 14:00
把最后一句的Range("A1:A10") = Arr2
改成Range("A1:P1") = WorksheetFunction.Transpose(Arr2)