|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim sht1 As Worksheet, sht2 As Worksheet, arr, i%, j%, n%, k%
-
- Set sht1 = Worksheets("表一")
- Set sht2 = Worksheets("表二")
- arr = sht1.UsedRange
- n = sht1.[a1].End(xlToRight).Column
- k = UBound(arr)
-
- For j = 1 To n
- For i = 2 To k
- If arr(1, j) = "编号" Then
- sht2.[a5000].End(xlUp).Offset(1, 0) = arr(i, j)
- ElseIf arr(1, j) = "流程" Then
- sht2.[b5000].End(xlUp).Offset(1, 0) = arr(i, j)
- ElseIf arr(1, j) = "数量" Then
- sht2.[c5000].End(xlUp).Offset(1, 0) = arr(i, j)
- End If
- Next
- Next
-
- End Sub
复制代码 |
|