|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Option Explicit
- Sub Main()
- Dim arr, brr()
- Dim i, j, tgt As Integer
- arr = Sheet1.Range("A1").CurrentRegion
- For i = 1 To UBound(arr, 2)
- For j = 1 To UBound(arr)
- If Len(arr(j, i)) > 0 Then
- tgt = tgt + 1
- ReDim Preserve brr(1 To 2, 1 To tgt)
- If j = 1 Then
- brr(1, tgt) = CStr(arr(j, i))
- brr(2, tgt) = "/"
- Else
- brr(1, tgt) = CStr(brr(1, tgt - 1))
- brr(2, tgt) = CStr(arr(j, i))
- End If
- End If
- Next j
- Next i
- Sheet3.UsedRange.ClearContents
- Sheet3.Range("A1").Resize(UBound(brr, 2), UBound(brr)) = WorksheetFunction.Transpose(brr)
- End Sub
复制代码
|
|