|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 dajiahaoxinku12 于 2013-8-3 23:59 编辑
Sub 变形()
arr = Range("a2:h" & Range("a65536").End(3).Row)
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2) * 2)
For k = 1 To UBound(arr, 2) - 1
For i = 1 To UBound(arr)
If IsError(arr(i, k + 1)) Then arr(i, k + 1) = -1
If arr(i, k + 1) > 0 Then
m = m + 1
brr(m, k * 2 - 1) = arr(i, 1)
brr(m, k * 2) = arr(i, k + 1)
End If
Next
m = 0
Next
Range("l2").Resize(UBound(brr), UBound(arr, 2) * 2) = brr
End Sub |
|