|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 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 |
|